public void FlushSocket(Socket s) {
//Let's try to flush the buffer:
ReceiveState rs = (ReceiveState)_sock_to_rs[s];
bool flushed = true;
if( rs != null ) {
lock( rs.Edge ) {
flushed = rs.Edge.Flush();
}
}
if( flushed ) {
//This socket is flushed, forget it:
_socks_to_send.Remove(s);
}
else {
//Make sure we continue to check this for writability
//This is a "set-like" operation, Add... is idempotent
AddSendWaiter(s);
}
}