From 08059d7fb37e975616bac50945ba7b0d145c242e Mon Sep 17 00:00:00 2001 From: Gabriel Braga Date: Thu, 4 Apr 2024 09:48:57 +0200 Subject: [PATCH] Handle EWOULDBLOCK at socket communication (#7596) This adds treatment to the EWOULDBLOCK error on socket comms. Previously only EAGAIN was treated. --- src/socket_handler.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) 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) -- 1.7.1