Skip to content
Snippets Groups Projects
Verified Commit 939cdafd authored by Benny Baumann's avatar Benny Baumann
Browse files

chg: Handle non-blocking sockets when sending data

parent 7a1428dc
No related branches found
No related tags found
No related merge requests found
...@@ -195,11 +195,12 @@ void tcp_client::push_write_queue(::ev::io &w) { ...@@ -195,11 +195,12 @@ void tcp_client::push_write_queue(::ev::io &w) {
iorecord buffer = this->write_queue.pop_front(); iorecord buffer = this->write_queue.pop_front();
ssize_t written = write(w.fd, buffer.ptr(), buffer.size()); ssize_t written = write(w.fd, buffer.ptr(), buffer.size());
if (written < 0) { if (written >= 0) {
buffer.advance((size_t)written);
} else if (errno != EAGAIN) {
throw netio_exception("Failed to write latest buffer content."); throw netio_exception("Failed to write latest buffer content.");
} }
buffer.advance((size_t)written);
this->write_queue.push_front(buffer); this->write_queue.push_front(buffer);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment