diff --git a/src/app/websockets/handler.rs b/src/app/websockets/handler.rs index 05a216a..e0d9341 100644 --- a/src/app/websockets/handler.rs +++ b/src/app/websockets/handler.rs @@ -28,18 +28,16 @@ pub async fn websocket_handler( }; let conn_id = manager_handle - .connect(session_token.clone(), &session) + .connect(&session_token, &session) .await .map_err(Error::from)?; log::info!("WebSocket connected: Connection ID {:?}", conn_id); - let session = Some(session); - let session_clone = session.clone(); actix_web::rt::spawn(async move { let mut last_heartbeat = Instant::now(); let mut interval = interval(HEARTBEAT_INTERVAL); - let mut session = session_clone; + let mut session = Some(session); loop { tokio::select! { diff --git a/src/app/websockets/manager.rs b/src/app/websockets/manager.rs index 7f18a34..5df9614 100644 --- a/src/app/websockets/manager.rs +++ b/src/app/websockets/manager.rs @@ -31,7 +31,7 @@ impl WebSocketManager { pub async fn connect( &self, - session_token: SessionToken, + session_token: &SessionToken, session: Session, ) -> io::Result { let conn_id = ConnId::new_v4(); @@ -228,7 +228,7 @@ impl WebSocketManagerHandle { pub async fn connect( &self, - session_token: SessionToken, + session_token: &SessionToken, session: &Session, ) -> io::Result { self.manager.connect(session_token, session.clone()).await