diff --git a/src/connection.rs b/src/connection.rs index 962b8f94..a0421763 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -623,7 +623,6 @@ mod tests { use bytes::Bytes; use color_eyre::eyre::{bail, Result}; use futures::future::OptionFuture; - use quinn::Endpoint as QuinnEndpoint; use std::time::Duration; #[tokio::test] @@ -631,10 +630,10 @@ mod tests { async fn basic_usage() -> Result<()> { let config = InternalConfig::try_from_config(Default::default())?; - let mut peer1 = QuinnEndpoint::server(config.server.clone(), local_addr())?; + let mut peer1 = quinn::Endpoint::server(config.server.clone(), local_addr())?; peer1.set_default_client_config(config.client); - let peer2 = QuinnEndpoint::server(config.server.clone(), local_addr())?; + let peer2 = quinn::Endpoint::server(config.server.clone(), local_addr())?; { let (p1_tx, mut p1_rx) = Connection::new( @@ -692,10 +691,10 @@ mod tests { ..Default::default() })?; - let mut peer1 = QuinnEndpoint::server(config.server.clone(), local_addr())?; + let mut peer1 = quinn::Endpoint::server(config.server.clone(), local_addr())?; peer1.set_default_client_config(config.client); - let peer2 = QuinnEndpoint::server(config.server.clone(), local_addr())?; + let peer2 = quinn::Endpoint::server(config.server.clone(), local_addr())?; // open a connection between the two peers let (p1_tx, _) = Connection::new( @@ -738,10 +737,10 @@ mod tests { async fn test_endpoint_echo() -> Result<()> { let config = InternalConfig::try_from_config(Config::default())?; - let mut peer1 = QuinnEndpoint::server(config.server.clone(), local_addr())?; + let mut peer1 = quinn::Endpoint::server(config.server.clone(), local_addr())?; peer1.set_default_client_config(config.client); - let peer2 = QuinnEndpoint::server(config.server.clone(), local_addr())?; + let peer2 = quinn::Endpoint::server(config.server.clone(), local_addr())?; { let (p1_tx, _) = Connection::new( @@ -789,10 +788,10 @@ mod tests { async fn endpoint_verification() -> Result<()> { let config = InternalConfig::try_from_config(Default::default())?; - let mut peer1 = QuinnEndpoint::server(config.server.clone(), local_addr())?; + let mut peer1 = quinn::Endpoint::server(config.server.clone(), local_addr())?; peer1.set_default_client_config(config.client.clone()); - let mut peer2 = QuinnEndpoint::server(config.server.clone(), local_addr())?; + let mut peer2 = quinn::Endpoint::server(config.server.clone(), local_addr())?; peer2.set_default_client_config(config.client); { diff --git a/src/endpoint.rs b/src/endpoint.rs index f5cd2d24..486cc194 100644 --- a/src/endpoint.rs +++ b/src/endpoint.rs @@ -97,8 +97,7 @@ impl Endpoint { let (termination_tx, termination_rx) = broadcast::channel(1); - let (mut quinn_endpoint, quinn_incoming) = - QuinnEndpoint::server(config.server.clone(), local_addr.into())?; + let mut quinn_endpoint = quinn::Endpoint::server(config.server.clone(), local_addr.into())?; // set client config used for any outgoing connections quinn_endpoint.set_default_client_config(config.client); @@ -129,11 +128,7 @@ impl Endpoint { let (connection_tx, connection_rx) = mpsc::channel(STANDARD_CHANNEL_SIZE); - listen_for_incoming_connections( - quinn_incoming, - connection_tx, - endpoint.quinn_endpoint.clone(), - ); + listen_for_incoming_connections(endpoint.quinn_endpoint.clone(), connection_tx); if let Some((contact, _)) = contact.as_ref() { let valid = endpoint @@ -420,13 +415,12 @@ impl Endpoint { } pub(super) fn listen_for_incoming_connections( - mut quinn_incoming: quinn::Incoming, - connection_tx: mpsc::Sender<(Connection, ConnectionIncoming)>, quinn_endpoint: quinn::Endpoint, + connection_tx: mpsc::Sender<(Connection, ConnectionIncoming)>, ) { let _ = tokio::spawn(async move { loop { - match quinn_incoming.next().await { + match quinn_endpoint.accept().await { Some(quinn_conn) => match quinn_conn.await { Ok(connection) => { let (connection, connection_incoming) =