[zeromq-dev] [PATCH] Fix synchronous connect failure for ipc://, tcp:// (LIBZMQ-294)

Martin Lucina martin at lucina.net
Wed Dec 14 00:09:11 CET 2011


A synchronous connect() failure in ipc_connecter can result in Assertion
failed: s == retired_fd (ipc_connecter.cpp:174), as reported in LIBZMQ-294.

This patch fixes the bug, and also an identical problem in tcp_connecter
which has not hit people since TCP connect() usually completes via the
asynchronous code path (poll, out_event).

Signed-off-by: Martin Lucina <martin at lucina.net>
---
 src/ipc_connecter.cpp |    1 +
 src/tcp_connecter.cpp |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/ipc_connecter.cpp b/src/ipc_connecter.cpp
index dc0ee21..58dccf4 100644
--- a/src/ipc_connecter.cpp
+++ b/src/ipc_connecter.cpp
@@ -135,6 +135,7 @@ void zmq::ipc_connecter_t::start_connecting ()
     }
 
     //  Handle any other error condition by eventual reconnect.
+    close ();
     wait = true;
     add_reconnect_timer();
 }
diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp
index 75079da..042e82a 100644
--- a/src/tcp_connecter.cpp
+++ b/src/tcp_connecter.cpp
@@ -146,6 +146,7 @@ void zmq::tcp_connecter_t::start_connecting ()
     }
 
     //  Handle any other error condition by eventual reconnect.
+    close ();
     wait = true;
     add_reconnect_timer();
 }
-- 
1.7.2.5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111214/357b03a2/attachment.sig>


More information about the zeromq-dev mailing list