summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/message.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/util/message.cpp b/util/message.cpp
index 37099dcbbc5..d59faaaccc6 100644
--- a/util/message.cpp
+++ b/util/message.cpp
@@ -544,7 +544,14 @@ again:
while( len > 0 ) {
int ret = ::send( sock , data , len , portSendFlags );
if ( ret == -1 ) {
- if ( errno != EAGAIN || _timeout == 0 ) {
+ if ( ( errno == EAGAIN || errno == EWOULDBLOCK ) && _timeout != 0 ) {
+ if ( !serverAlive( farEnd.toString() ) ) {
+ log(_logLevel) << "MessagingPort " << context << " send() remote dead " << farEnd.toString() << endl;
+ throw SocketException( SocketException::SEND_ERROR );
+ }
+ // should just retry
+ }
+ else {
SocketException::Type t = SocketException::SEND_ERROR;
#if defined(_WINDOWS)
if( e == WSAETIMEDOUT ) t = SocketException::SEND_TIMEOUT;
@@ -552,12 +559,6 @@ again:
log(_logLevel) << "MessagingPort " << context << " send() " << errnoWithDescription() << ' ' << farEnd.toString() << endl;
throw SocketException( t );
}
- else {
- if ( !serverAlive( farEnd.toString() ) ) {
- log(_logLevel) << "MessagingPort " << context << " send() remote dead " << farEnd.toString() << endl;
- throw SocketException( SocketException::SEND_ERROR );
- }
- }
}
else {
assert( ret <= len );