Skip to content

Commit f946577

Browse files
committed
remove unnecessary async requirement for Server::new
1 parent 0dd25bb commit f946577

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

examples/echo-server.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ async fn main() {
5757

5858
let mut rtc_server =
5959
webrtc_unreliable::tokio::new_server(webrtc_listen_addr, public_webrtc_addr)
60-
.await
6160
.expect("could not start RTC server");
6261

6362
let session_endpoint = rtc_server.session_endpoint();

src/server.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<R: Runtime> Server<R> {
221221
///
222222
/// WebRTC connections must be started via an external communication channel from a browser via
223223
/// the `SessionEndpoint`, after which a WebRTC data channel can be opened.
224-
pub async fn new(
224+
pub fn new(
225225
runtime: R,
226226
listen_addr: SocketAddr,
227227
public_addr: SocketAddr,
@@ -232,15 +232,14 @@ impl<R: Runtime> Server<R> {
232232
public_addr,
233233
SslConfig::create().expect("WebRTC server could not initialize OpenSSL primitives"),
234234
)
235-
.await
236235
}
237236

238237
/// Start a new WebRTC data channel server with the given `SslConfig`.
239238
///
240239
/// This can be used to share self-signed TLS certificates between different `Server` instances,
241240
/// which is important in certain browsers (Firefox) when connecting to multiple WebRTC
242241
/// endpoints from the same page.
243-
pub async fn with_ssl_config(
242+
pub fn with_ssl_config(
244243
runtime: R,
245244
listen_addr: SocketAddr,
246245
public_addr: SocketAddr,

src/tokio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ impl crate::runtime::Runtime for Runtime {
6262

6363
pub type Server = crate::server::Server<Runtime>;
6464

65-
pub async fn new_server(
65+
pub fn new_server(
6666
listen_addr: SocketAddr,
6767
public_addr: SocketAddr,
6868
) -> Result<crate::server::Server<Runtime>, io::Error> {
69-
crate::server::Server::new(Runtime, listen_addr, public_addr).await
69+
crate::server::Server::new(Runtime, listen_addr, public_addr)
7070
}

0 commit comments

Comments
 (0)