mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-28 19:52:00 +01:00
Memory leak in PUB/XPUB sockets fixed.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
14
src/xpub.cpp
14
src/xpub.cpp
@@ -25,11 +25,10 @@
|
||||
|
||||
zmq::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_) :
|
||||
socket_base_t (parent_, tid_),
|
||||
dist (this),
|
||||
fq (this)
|
||||
dist (this)
|
||||
{
|
||||
options.type = ZMQ_XPUB;
|
||||
options.requires_in = true;
|
||||
options.requires_in = false;
|
||||
options.requires_out = true;
|
||||
}
|
||||
|
||||
@@ -40,16 +39,14 @@ zmq::xpub_t::~xpub_t ()
|
||||
void zmq::xpub_t::xattach_pipes (class reader_t *inpipe_,
|
||||
class writer_t *outpipe_, const blob_t &peer_identity_)
|
||||
{
|
||||
zmq_assert (inpipe_ && outpipe_);
|
||||
zmq_assert (!inpipe_ && outpipe_);
|
||||
dist.attach (outpipe_);
|
||||
fq.attach (inpipe_);
|
||||
}
|
||||
|
||||
void zmq::xpub_t::process_term (int linger_)
|
||||
{
|
||||
// Terminate the outbound pipes.
|
||||
dist.terminate ();
|
||||
fq.terminate ();
|
||||
|
||||
// Continue with the termination immediately.
|
||||
socket_base_t::process_term (linger_);
|
||||
@@ -67,11 +64,12 @@ bool zmq::xpub_t::xhas_out ()
|
||||
|
||||
int zmq::xpub_t::xrecv (zmq_msg_t *msg_, int flags_)
|
||||
{
|
||||
return fq.recv (msg_, flags_);
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool zmq::xpub_t::xhas_in ()
|
||||
{
|
||||
return fq.has_in ();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user