Commit 3ec0e770 authored by Constantin Rack's avatar Constantin Rack

Merge pull request #1384 from hurtonm/master

Release memory on connection termination for pub, push sockets
parents aabbe3f3 2e06737b
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
*/ */
#include "pub.hpp" #include "pub.hpp"
#include "pipe.hpp"
#include "err.hpp"
#include "msg.hpp" #include "msg.hpp"
zmq::pub_t::pub_t (class ctx_t *parent_, uint32_t tid_, int sid_) : zmq::pub_t::pub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
...@@ -30,6 +32,17 @@ zmq::pub_t::~pub_t () ...@@ -30,6 +32,17 @@ zmq::pub_t::~pub_t ()
{ {
} }
void zmq::pub_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{
zmq_assert (pipe_);
// Don't delay pipe termination as there is no one
// to receive the delimiter.
pipe_->set_nodelay ();
xpub_t::xattach_pipe (pipe_, subscribe_to_all_);
}
int zmq::pub_t::xrecv (class msg_t *) int zmq::pub_t::xrecv (class msg_t *)
{ {
// Messages cannot be received from PUB socket. // Messages cannot be received from PUB socket.
......
...@@ -38,6 +38,7 @@ namespace zmq ...@@ -38,6 +38,7 @@ namespace zmq
~pub_t (); ~pub_t ();
// Implementations of virtual functions from socket_base_t. // Implementations of virtual functions from socket_base_t.
void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_ = false);
int xrecv (zmq::msg_t *msg_); int xrecv (zmq::msg_t *msg_);
bool xhas_in (); bool xhas_in ();
......
...@@ -36,6 +36,9 @@ void zmq::push_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_) ...@@ -36,6 +36,9 @@ void zmq::push_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{ {
// subscribe_to_all_ is unused // subscribe_to_all_ is unused
(void)subscribe_to_all_; (void)subscribe_to_all_;
// Don't delay pipe termination as there is no one
// to receive the delimiter.
pipe_->set_nodelay ();
zmq_assert (pipe_); zmq_assert (pipe_);
lb.attach (pipe_); lb.attach (pipe_);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment