From acf0b0e515515e51ad32ba7a2d147ce703579478 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Sun, 22 May 2011 17:26:53 +0200 Subject: 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 --- src/pair.hpp | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'src/pair.hpp') diff --git a/src/pair.hpp b/src/pair.hpp index a10e15a..2cb050a 100644 --- a/src/pair.hpp +++ b/src/pair.hpp @@ -29,8 +29,7 @@ namespace zmq class pair_t : public socket_base_t, - public i_reader_events, - public i_writer_events + public i_pipe_events { public: @@ -38,32 +37,23 @@ namespace zmq ~pair_t (); // Overloads of functions from socket_base_t. - void xattach_pipes (class reader_t *inpipe_, class writer_t *outpipe_, - const blob_t &peer_identity_); + void xattach_pipe (class pipe_t *pipe_, const blob_t &peer_identity_); int xsend (class msg_t *msg_, int flags_); int xrecv (class msg_t *msg_, int flags_); bool xhas_in (); bool xhas_out (); - // i_reader_events interface implementation. - void activated (class reader_t *pipe_); - void terminated (class reader_t *pipe_); - void delimited (class reader_t *pipe_); - - // 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_); private: // Hook into termination process. void process_term (int linger_); - class reader_t *inpipe; - class writer_t *outpipe; - - bool inpipe_alive; - bool outpipe_alive; + class pipe_t *pipe; bool terminating; -- cgit v1.2.3