pub async fn run(self) {
        loop {
            let connection = self.listener.accept().await;
            match connection {
                Err(e) => error!("Accept failed: {:?}", e),
                Ok(stream) => {
                    let client_id = self.id_counter.fetch_add(1, Ordering::Relaxed);
                    let main_tx = self.main_tx.clone();
                    tokio::spawn(async move {
                        let socket = match Socket::new(stream.0, client_id, main_tx).await {
                            Ok(socket) => socket,
                            Err(e) => {
                                error!("Client disconnected: {}", e);
                                return;
                            }
                        };
                        if let Err(e) = socket.handle().await {
                            error!("Client error: {}", e);
                            return;
                        };
                    });
                }
            }
        }
    }
/// Start the listener loop, which will spawn individual connections into the runtime
Start the listener loop, which will spawn individual connections into the runtime
Start the listener loop which will spawn individual connections into the runtime
pub async fn run(self) {
        loop {
            let connection = self.listener.accept().await;
            match connection {
                Err(e) => error!("Accept failed: {:?}", e),
                Ok(stream) => {
                    let client_id = self.id_counter.fetch_add(1, Ordering::Relaxed);
                    let main_tx = self.main_tx.clone();
                    tokio::spawn(async move {
                        let socket = match Socket::new(stream.0, client_id, main_tx).await {
                            Ok(socket) => socket,
                            Err(e) => {
                                error!("Client disconnected: {}", e);
                                return;
                            }
                        };
                        if let Err(e) = socket.handle().await {
                            error!("Client error: {}", e);
                            return;
                        };
                    });
                }
            }
        }
    }
pub async fn run ( self ) { loop { let connection = self . listener . accept ( ) . await ; match connection { Err ( e ) => error ! ( " " e ) , Ok ( stream ) => { let client_id = self . id_counter . fetch_add ( 1 , Ordering :: Relaxed ) ; let main_tx = self . main_tx . clone ( ) ; tokio :: spawn ( async move { let socket = match Socket :: new ( stream . 0 , client_id , main_tx ) . await { Ok ( socket ) => socket , Err ( e ) => { error ! ( " " e ) ; return ; } } ; if let Err ( e ) = socket . handle ( ) . await { error ! ( " " e ) ; return ; } ; } ) ; } } } }
Start the listener loop, which will spawn individual connections into the runtime
Start the listener loop which will spawn individual connections into the runtime
self