fn close(&self, conn_id: usize) {
        // we only do a fast drop for connections that never fully connected
        let conn_uuid: u128 = conn_id.try_into().unwrap();
        let mut fast_drop = true;
        log::debug!("coordinator notifed that connection {} is gone", conn_id);
        if let Some(gone) = self.kv.get(&"gone_message".to_string()) {
            let mutable = self.mutable.lock();
            if let Some(name) = mutable.names.get(&conn_uuid) {
                if let Some(sender) = mutable.consumers.get(&conn_uuid) {
                    fast_drop = false;
                    let mut msg = name.clone();
                    msg.extend(gone.as_bytes().to_vec());
                    // send out the leave notification
                    send_cmd(sender, ChatCmd::NewData(conn_uuid, Arc::new(msg)));
                }
            }
            if !fast_drop {
                // let everyone know that the connection is gone
                for sender in mutable.consumers.values() {
                    send_cmd(sender, ChatCmd::RemoveSink(conn_uuid));
                }
            }
        }
        if fast_drop {
            self.remove_sink(conn_uuid);
        }
    }
// notification that a connection has closed. let everyone know that its gone
notification that a connection has closed. let everyone know that its gone
notification that a connection has closed . let everyone know that its gone
fn close(&self, conn_id: usize) {
        // we only do a fast drop for connections that never fully connected
        let conn_uuid: u128 = conn_id.try_into().unwrap();
        let mut fast_drop = true;
        log::debug!("coordinator notifed that connection {} is gone", conn_id);
        if let Some(gone) = self.kv.get(&"gone_message".to_string()) {
            let mutable = self.mutable.lock();
            if let Some(name) = mutable.names.get(&conn_uuid) {
                if let Some(sender) = mutable.consumers.get(&conn_uuid) {
                    fast_drop = false;
                    let mut msg = name.clone();
                    msg.extend(gone.as_bytes().to_vec());
                    // send out the leave notification
                    send_cmd(sender, ChatCmd::NewData(conn_uuid, Arc::new(msg)));
                }
            }
            if !fast_drop {
                // let everyone know that the connection is gone
                for sender in mutable.consumers.values() {
                    send_cmd(sender, ChatCmd::RemoveSink(conn_uuid));
                }
            }
        }
        if fast_drop {
            self.remove_sink(conn_uuid);
        }
    }
fn close ( & self , conn_id : usize ) { // we only do a fast drop for connections that never fully connected let conn_uuid : u128 = conn_id . try_into ( ) . unwrap ( ) ; let mut fast_drop = true ; log :: debug ! ( " " conn_id ) ; if let Some ( gone ) = self . kv . get ( & " " . to_string ( ) ) { let mutable = self . mutable . lock ( ) ; if let Some ( name ) = mutable . names . get ( & conn_uuid ) { if let Some ( sender ) = mutable . consumers . get ( & conn_uuid ) { fast_drop = false ; let mut msg = name . clone ( ) ; msg . extend ( gone . as_bytes ( ) . to_vec ( ) ) ; // send out the leave notification send_cmd ( sender , ChatCmd :: NewData ( conn_uuid , Arc :: new ( msg ) ) ) ; } } if ! fast_drop { // let everyone know that the connection is gone for sender in mutable . consumers . values ( ) { send_cmd ( sender , ChatCmd :: RemoveSink ( conn_uuid ) ) ; } } } if fast_drop { self . remove_sink ( conn_uuid ) ; } }
notification that a connection has closed.
notification that a connection has closed .
&self
conn_id
usize