From e924381bae58ca828c9691b9d4d772a20a91c717 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Fri, 11 May 2012 16:23:06 +0200 Subject: Command throttling breaking HWM algorithms -- fixed. When HWM was set to small value it may have happened that command indicating that pipe is ready for writing wasn't processed because of command throttling. Signed-off-by: Martin Sustrik --- src/socket_base.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/socket_base.cpp b/src/socket_base.cpp index ad8666a..86c01b0 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -614,11 +614,18 @@ int xs::socket_base_t::send (msg_t *msg_, int flags_) if (unlikely (errno != EAGAIN)) return -1; - // In case of non-blocking send we'll simply propagate - // the error - including EAGAIN - up the stack. int timeout = sndtimeo (); - if (flags_ & XS_DONTWAIT || timeout == 0) - return -1; + if (flags_ & XS_DONTWAIT || timeout == 0) { + + // It looks like pipe is full. However, previous process_commands may + // have done nothing because of the throttling. Thus, let's give it + // last try and force commands to be processed. Then try to re-send + // the message. + rc = process_commands (0, false); + if (unlikely (rc != 0)) + return -1; + return xsend (msg_, flags_); + } // Compute the time when the timeout should occur. // If the timeout is infite, don't care. -- cgit v1.2.3