fn write(&mut self, token: Token, work: Vec<u8>) {
        trace!("send to {:?}", token);
        self.send_stat(token, Stat::SocketWrite);
        self.times[token.0] = self.clocksource.counter();
        if self.connections[token].write(work).is_ok() {
            self.set_timeout(token);
            if let Some(s) = self.connections[token].stream() {
                self.register(s, token);
            }
            if self.connections[token].is_readable() {
                self.send_stat(token, Stat::RequestSent);
            }
        } else {
            debug!("couldn't write");

            self.send_stat(token, Stat::ConnectError);
            self.reconnect(token);
        }
    }
/// write bytes to connection
/// - reconnect on failure
/// - transition to Reading if entire buffer written in one call
write bytes to connection
reconnect on failure
transition to Reading if entire buffer written in one call
write bytes to connection reconnect on failure transition to Reading if entire buffer written in one call
fn write(&mut self, token: Token, work: Vec<u8>) {
        trace!("send to {:?}", token);
        self.send_stat(token, Stat::SocketWrite);
        self.times[token.0] = self.clocksource.counter();
        if self.connections[token].write(work).is_ok() {
            self.set_timeout(token);
            if let Some(s) = self.connections[token].stream() {
                self.register(s, token);
            }
            if self.connections[token].is_readable() {
                self.send_stat(token, Stat::RequestSent);
            }
        } else {
            debug!("couldn't write");
            self.send_stat(token, Stat::ConnectError);
            self.reconnect(token);
        }
    }
fn write ( & mut self , token : Token , work : Vec < u8 > ) { trace ! ( " " token ) ; self . send_stat ( token , Stat :: SocketWrite ) ; self . times [ token . 0 ] = self . clocksource . counter ( ) ; if self . connections [ token ] . write ( work ) . is_ok ( ) { self . set_timeout ( token ) ; if let Some ( s ) = self . connections [ token ] . stream ( ) { self . register ( s , token ) ; } if self . connections [ token ] . is_readable ( ) { self . send_stat ( token , Stat :: RequestSent ) ; } } else { debug ! ( " " ) ; self . send_stat ( token , Stat :: ConnectError ) ; self . reconnect ( token ) ; } }
write bytes to connection
 reconnect on failure
 transition to Reading if entire buffer written in one call
write bytes to connection reconnect on failure transition to Reading if entire buffer written in one call
&mut self
token
Token
work
Vec<u8>
&mut self
token
Token
work
Vec<u8>