diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2010-09-17 12:58:20 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-09-17 12:58:20 +0200 |
commit | c7b9ba3ccdd5a18afb22dda1afee16c938076c25 (patch) | |
tree | cfaab4b02d3c6e7e2437f790364885babd033622 | |
parent | 85aa25e56cbf6f4194162235fc06bed8683b1bad (diff) |
reconnection process fixed when failure occurs during init phase
-rw-r--r-- | src/command.hpp | 3 | ||||
-rw-r--r-- | src/session.cpp | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/command.hpp b/src/command.hpp index a72d3ca..c64ca92 100644 --- a/src/command.hpp +++ b/src/command.hpp @@ -64,7 +64,8 @@ namespace zmq class own_t *object; } own; - // Attach the engine to the session. + // Attach the engine to the session. If engine is NULL, it informs + // session that the connection have failed. struct { struct i_engine *engine; unsigned char peer_identity_size; diff --git a/src/session.cpp b/src/session.cpp index fd6a7ee..eb23eee 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -178,6 +178,14 @@ void zmq::session_t::finalise () void zmq::session_t::process_attach (i_engine *engine_, const blob_t &peer_identity_) { + // If some other object (e.g. init) notifies us that the connection failed + // we need to start the reconnection process. + if (!engine_) { + zmq_assert (!engine); + detached (); + return; + } + // Check whether the required pipes already exist. If not so, we'll // create them and bind them to the socket object. reader_t *socket_reader = NULL; |