summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-12-01 15:12:42 +0100
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-12-01 15:12:42 +0100
commitc04583ff6ca3c27de5628a61b6b6ce59fd13c9d9 (patch)
tree0cd2f113cf9a68709b46eee87c29a74a4a822838 /src
parent0d704fceee5e1bd0fe9438fa380452b69cd29114 (diff)
minor code beautification
Diffstat (limited to 'src')
-rw-r--r--src/pipe.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pipe.cpp b/src/pipe.cpp
index 31b9199..d994430 100644
--- a/src/pipe.cpp
+++ b/src/pipe.cpp
@@ -34,13 +34,16 @@ zmq::reader_t::reader_t (object_t *parent_,
zmq::reader_t::~reader_t ()
{
+ if (pipe)
+ unregister_pipe (pipe);
}
void zmq::reader_t::set_pipe (pipe_t *pipe_)
{
zmq_assert (!pipe);
pipe = pipe_;
- peer = &pipe_->writer;
+ peer = &pipe->writer;
+ register_pipe (pipe);
}
bool zmq::reader_t::check_read ()
@@ -125,7 +128,7 @@ void zmq::writer_t::set_pipe (pipe_t *pipe_)
{
zmq_assert (!pipe);
pipe = pipe_;
- peer = &pipe_->reader;
+ peer = &pipe->reader;
}
bool zmq::writer_t::check_write (uint64_t size_)
@@ -180,7 +183,6 @@ zmq::pipe_t::pipe_t (object_t *reader_parent_, object_t *writer_parent_,
{
reader.set_pipe (this);
writer.set_pipe (this);
- reader.register_pipe (this);
}
zmq::pipe_t::~pipe_t ()
@@ -191,6 +193,4 @@ zmq::pipe_t::~pipe_t ()
zmq_msg_t msg;
while (read (&msg))
zmq_msg_close (&msg);
-
- reader.unregister_pipe (this);
}