mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-17 03:03:25 +02:00
Fix a number of whitespace issues in various parts of the code, add validation to most calls on the test and take a first stab at implementing the reconnection pipe blocking.
It didn't seem straightforward to use any of the existing process calls, so I have added a new command to command_t and friends called detach. This instructs the socket_base to remove the pipe from it's pipe list. The session base stores a copy of the outpipe, and will resend the bind command on reconnection. This should allow balancing again.
This commit is contained in:
@@ -228,7 +228,7 @@ void zmq::session_base_t::clean_pipes ()
|
||||
}
|
||||
|
||||
void zmq::session_base_t::terminated (pipe_t *pipe_)
|
||||
{
|
||||
{
|
||||
// Drop the reference to the deallocated pipe.
|
||||
zmq_assert (pipe == pipe_);
|
||||
pipe = NULL;
|
||||
@@ -306,9 +306,15 @@ void zmq::session_base_t::process_attach (i_engine *engine_)
|
||||
zmq_assert (!pipe);
|
||||
pipe = pipes [0];
|
||||
|
||||
// Remember the remote end of the pipe if required
|
||||
if (options.delay_attach_on_connect == 1)
|
||||
outpipe = pipes [1];
|
||||
|
||||
// Ask socket to plug into the pipe.
|
||||
send_bind (socket, pipes [1]);
|
||||
}
|
||||
else if (outpipe && (options.delay_attach_on_connect == 1))
|
||||
send_bind (socket, outpipe);
|
||||
|
||||
// Plug in the engine.
|
||||
zmq_assert (!engine);
|
||||
@@ -405,6 +411,11 @@ void zmq::session_base_t::detached ()
|
||||
// the socket object to resend all the subscriptions.
|
||||
if (pipe && (options.type == ZMQ_SUB || options.type == ZMQ_XSUB))
|
||||
pipe->hiccup ();
|
||||
|
||||
// For delayed connect situations, hiccup the socket to have it
|
||||
// pause usage of this pipe
|
||||
if (outpipe && options.delay_attach_on_connect == 1)
|
||||
send_detach(socket, outpipe);
|
||||
}
|
||||
|
||||
void zmq::session_base_t::start_connecting (bool wait_)
|
||||
|
Reference in New Issue
Block a user