reconnection process fixed when failure occurs during init phase

This commit is contained in:
Martin Sustrik 2010-09-17 12:58:20 +02:00
parent 85aa25e56c
commit c7b9ba3ccd
2 changed files with 10 additions and 1 deletions

View File

@ -64,7 +64,8 @@ namespace zmq
class own_t *object; class own_t *object;
} own; } 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 {
struct i_engine *engine; struct i_engine *engine;
unsigned char peer_identity_size; unsigned char peer_identity_size;

View File

@ -178,6 +178,14 @@ void zmq::session_t::finalise ()
void zmq::session_t::process_attach (i_engine *engine_, void zmq::session_t::process_attach (i_engine *engine_,
const blob_t &peer_identity_) 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 // Check whether the required pipes already exist. If not so, we'll
// create them and bind them to the socket object. // create them and bind them to the socket object.
reader_t *socket_reader = NULL; reader_t *socket_reader = NULL;