diff --git a/gateway/src/main.rs b/gateway/src/main.rs index 1d8b02abd3..8dd4e83717 100644 --- a/gateway/src/main.rs +++ b/gateway/src/main.rs @@ -12,19 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +use futures::lock::Mutex; use futures_util::{SinkExt, StreamExt}; use log::*; -use std::sync::{Arc}; -use futures::lock::Mutex; use std::net::SocketAddr; +use std::sync::Arc; use std::time::Duration; use tokio::net::{TcpListener, TcpStream}; use tokio_tungstenite::{accept_async, tungstenite::Error}; use tungstenite::Message; use tungstenite::Result; -async fn accept_connection(peer: SocketAddr, stream: TcpStream, client: Arc>) { - +async fn accept_connection( + peer: SocketAddr, + stream: TcpStream, + client: Arc>, +) { if let Err(e) = handle_connection(peer, stream, client).await { match e { Error::ConnectionClosed | Error::Protocol(_) | Error::Utf8 => (), @@ -33,7 +36,11 @@ async fn accept_connection(peer: SocketAddr, stream: TcpStream, client: Arc>) -> Result<()> { +async fn handle_connection( + peer: SocketAddr, + stream: TcpStream, + client_ref: Arc>, +) -> Result<()> { let mut ws_stream = accept_async(stream).await.expect("Failed to accept"); info!("New WebSocket connection: {}", peer); @@ -48,16 +55,14 @@ async fn handle_connection(peer: SocketAddr, stream: TcpStream, client: Arc Arc> { - let config = multi_tcp_client::Config::new( + let config = multi_tcp_client::Config::new( Duration::from_millis(200), Duration::from_secs(86400), Duration::from_secs(2),