From: Gabriel Braga Date: Thu, 4 Apr 2024 07:48:57 +0000 (+0200) Subject: Handle EWOULDBLOCK at socket communication (#7596) X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=08059d7fb37e975616bac50945ba7b0d145c242e;hp=6f59dcf596103d0bc69be841627cd9926faa4139;p=libt2n Handle EWOULDBLOCK at socket communication (#7596) This adds treatment to the EWOULDBLOCK error on socket comms. Previously only EAGAIN was treated. --- diff --git a/src/socket_handler.cpp b/src/socket_handler.cpp index 0cc5036..f1f5ef7 100644 --- a/src/socket_handler.cpp +++ b/src/socket_handler.cpp @@ -248,7 +248,7 @@ bool socket_handler::fill_buffer(std::string& buffer) if (nbytes < 0) { - if (errno == EAGAIN) + if (errno == EAGAIN || errno == EWOULDBLOCK) return read_something; // no (more) data was waiting else if (errno == EINTR) { @@ -301,10 +301,10 @@ void socket_handler::socket_write(const std::string& data) int rtn; while ((rtn=::write(sock, data.data()+offset, write_size)) == -1 && - (errno == EAGAIN || errno == EINTR)) + (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)) { wait_ready_to_write(sock,write_timeout); - LOGSTREAM(debug,"resuming write() call after EAGAIN or EINTR"); + LOGSTREAM(debug,"resuming write() call after EAGAIN or EINTR or EWOULDBLOCK"); } if (rtn == -1)