summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/command.hpp3
-rw-r--r--src/session.cpp8
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;