fn store_connection(&mut self, server_token: &Token, connection: TcpStream, address: SocketAddr) -> net::Result<()> {
        if let Some(server) = self.servers.get(server_token.0) {
            let entry = self.connections.vacant_entry();
            let key = entry.key();
            let token = Token(key + 1024);
            let conn = Connection::new(server.sender.clone(), connection);
            entry.insert(conn);
            send_cmd(
                &server.sender,
                NetCmd::NewConn(token.0, server.bind_addr.to_string(), address.to_string(), MAX_BYTES),
            );
        }
        Ok(())
    }
// The server sender is stored as a placeholder, it will be replaced subsequently.
The server sender is stored as a placeholder, it will be replaced subsequently.
The server sender is stored as a placeholder it will be replaced subsequently .
fn store_connection(&mut self, server_token: &Token, connection: TcpStream, address: SocketAddr) -> net::Result<()> {
        if let Some(server) = self.servers.get(server_token.0) {
            let entry = self.connections.vacant_entry();
            let key = entry.key();
            let token = Token(key + 1024);
            let conn = Connection::new(server.sender.clone(), connection);
            entry.insert(conn);
            send_cmd(
                &server.sender,
                NetCmd::NewConn(token.0, server.bind_addr.to_string(), address.to_string(), MAX_BYTES),
            );
        }
        Ok(())
    }
fn store_connection ( & mut self , server_token : & Token , connection : TcpStream , address : SocketAddr ) -> net :: Result < ( ) > { if let Some ( server ) = self . servers . get ( server_token . 0 ) { let entry = self . connections . vacant_entry ( ) ; let key = entry . key ( ) ; let token = Token ( key + 1024 ) ; let conn = Connection :: new ( server . sender . clone ( ) , connection ) ; entry . insert ( conn ) ; send_cmd ( & server . sender , NetCmd :: NewConn ( token . 0 , server . bind_addr . to_string ( ) , address . to_string ( ) , MAX_BYTES ) , ) ; } Ok ( ( ) ) }
The server sender is stored as a placeholder, it will be replaced subsequently.
The server sender is stored as a placeholder it will be replaced subsequently .
&mut self
server_token
&Token
connection
TcpStream
address
SocketAddr