summaryrefslogtreecommitdiff
path: root/src/session.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-05-22 17:26:53 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-05-22 17:26:53 +0200
commitacf0b0e515515e51ad32ba7a2d147ce703579478 (patch)
treed2032009cf46c23aa0f677c2216914f718ab968a /src/session.hpp
parent9e6b39925603f9e64db08c469bd628d7ef9465de (diff)
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>
Diffstat (limited to 'src/session.hpp')
-rw-r--r--src/session.hpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/session.hpp b/src/session.hpp
index d2f8882..4a12d68 100644
--- a/src/session.hpp
+++ b/src/session.hpp
@@ -34,8 +34,7 @@ namespace zmq
public own_t,
public io_object_t,
public i_inout,
- public i_reader_events,
- public i_writer_events
+ public i_pipe_events
{
public:
@@ -50,17 +49,12 @@ namespace zmq
void flush ();
void detach ();
- void attach_pipes (class reader_t *inpipe_, class writer_t *outpipe_,
- const blob_t &peer_identity_);
-
- // i_reader_events interface implementation.
- void activated (class reader_t *pipe_);
- void terminated (class reader_t *pipe_);
- void delimited (class reader_t *pipe_);
+ void attach_pipe (class pipe_t *pipe_, const blob_t &peer_identity_);
- // i_writer_events interface implementation.
- void activated (class writer_t *pipe_);
- void terminated (class writer_t *pipe_);
+ // i_pipe_events interface implementation.
+ void read_activated (class pipe_t *pipe_);
+ void write_activated (class pipe_t *pipe_);
+ void terminated (class pipe_t *pipe_);
protected:
@@ -103,16 +97,13 @@ namespace zmq
// Call this function to move on with the delayed process_term.
void proceed_with_term ();
- // Inbound pipe, i.e. one the session is getting messages from.
- class reader_t *in_pipe;
+ // Pipe connecting the session to its socket.
+ class pipe_t *pipe;
// This flag is true if the remainder of the message being processed
// is still in the in pipe.
bool incomplete_in;
- // Outbound pipe, i.e. one the socket is sending messages to.
- class writer_t *out_pipe;
-
// The protocol I/O engine connected to the session.
struct i_engine *engine;
@@ -123,8 +114,8 @@ namespace zmq
// the engines into the same thread.
class io_thread_t *io_thread;
- // If true, pipes were already attached to this session.
- bool pipes_attached;
+ // If true, pipe was already attached to this session.
+ bool pipe_attached;
// If true, delimiter was already read from the inbound pipe.
bool delimiter_processed;