Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fixed an issue with delayed writes
Browse files Browse the repository at this point in the history
  • Loading branch information
arkpar committed Sep 14, 2016
1 parent 86aeab3 commit f326b59
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions util/network/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ impl<Socket: GenericSocket> GenericConnection<Socket> {
/// Add a packet to send queue.
pub fn send<Message>(&mut self, io: &IoContext<Message>, data: Bytes) where Message: Send + Clone {
if !data.is_empty() {
trace!(target:"network", "{}: Sending {} bytes", self.token, data.len());
self.send_queue.push_back(Cursor::new(data));
}
if !self.interest.is_writable() {
self.interest.insert(EventSet::writable());
if !self.interest.is_writable() {
self.interest.insert(EventSet::writable());
}
io.update_registration(self.token).ok();
}
}
Expand Down

0 comments on commit f326b59

Please sign in to comment.