Introduces bi-directional pipes

So far, there was a pair of unidirectional pipes between a socket
and a session (or an inproc peer). This resulted in complex
problems with half-closed states and tracking which inpipe
corresponds to which outpipe.

This patch doesn't add any functionality in itself, but is
essential for further work on features like subscription
forwarding.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
Martin Sustrik
2011-05-22 17:26:53 +02:00
parent 9e6b399256
commit acf0b0e515
34 changed files with 709 additions and 769 deletions

View File

@@ -39,10 +39,8 @@ zmq::lb_t::~lb_t ()
zmq_assert (pipes.empty ());
}
void zmq::lb_t::attach (writer_t *pipe_)
void zmq::lb_t::attach (pipe_t *pipe_)
{
pipe_->set_event_sink (this);
pipes.push_back (pipe_);
pipes.swap (active, pipes.size () - 1);
active++;
@@ -63,7 +61,7 @@ void zmq::lb_t::terminate ()
pipes [i]->terminate ();
}
void zmq::lb_t::terminated (writer_t *pipe_)
void zmq::lb_t::terminated (pipe_t *pipe_)
{
pipes_t::size_type index = pipes.index (pipe_);
@@ -85,7 +83,7 @@ void zmq::lb_t::terminated (writer_t *pipe_)
sink->unregister_term_ack ();
}
void zmq::lb_t::activated (writer_t *pipe_)
void zmq::lb_t::activated (pipe_t *pipe_)
{
// Move the pipe to the list of active pipes.
pipes.swap (pipes.index (pipe_), active);