summaryrefslogtreecommitdiff
path: root/src/pipe.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-08-28 16:51:46 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-08-28 16:51:46 +0200
commitcb09c6951e2c4405318b422a1f9213af3e4b6b8a (patch)
treefb5d4dfd6a71745e885b2501f19cfbbb38c6f441 /src/pipe.hpp
parent2dd501651592baa7f9e49f52e1321ae2b9b4e126 (diff)
pipe deallocation added
Diffstat (limited to 'src/pipe.hpp')
-rw-r--r--src/pipe.hpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/pipe.hpp b/src/pipe.hpp
index b7593c7..b4e592a 100644
--- a/src/pipe.hpp
+++ b/src/pipe.hpp
@@ -39,25 +39,29 @@ namespace zmq
uint64_t hwm_, uint64_t lwm_);
~reader_t ();
+ void set_endpoint (i_endpoint *endpoint_);
+
// Reads a message to the underlying pipe.
bool read (struct zmq_msg_t *msg_);
- void set_endpoint (i_endpoint *endpoint_);
-
// Mnaipulation of index of the pipe.
void set_index (int index_);
int get_index ();
+ // Ask pipe to terminate.
+ void term ();
+
private:
// Command handlers.
void process_revive ();
+ void process_pipe_term_ack ();
// The underlying pipe.
class pipe_t *pipe;
// Pipe writer associated with the other side of the pipe.
- class object_t *peer;
+ class writer_t *peer;
// High and low watermarks for in-memory storage (in bytes).
uint64_t hwm;
@@ -86,6 +90,8 @@ namespace zmq
uint64_t hwm_, uint64_t lwm_);
~writer_t ();
+ void set_endpoint (i_endpoint *endpoint_);
+
// Checks whether message with specified size can be written to the
// pipe. If writing the message would cause high watermark to be
// exceeded, the function returns false.
@@ -98,13 +104,23 @@ namespace zmq
// Flush the messages downsteam.
void flush ();
+ // Mnaipulation of index of the pipe.
+ void set_index (int index_);
+ int get_index ();
+
+ // Ask pipe to terminate.
+ void term ();
+
private:
+ // Command handlers.
+ void process_pipe_term ();
+
// The underlying pipe.
class pipe_t *pipe;
// Pipe reader associated with the other side of the pipe.
- class object_t *peer;
+ class reader_t *peer;
// High and low watermarks for in-memory storage (in bytes).
uint64_t hwm;
@@ -114,6 +130,12 @@ namespace zmq
uint64_t head;
uint64_t tail;
+ // Index of the pipe in the socket's list of outbound pipes.
+ int index;
+
+ // Endpoint (either session or socket) the pipe is attached to.
+ i_endpoint *endpoint;
+
writer_t (const writer_t&);
void operator = (const writer_t&);
};