From d4e418f5f48a4d73e0a80a54593d11a6cd86d7bc Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Fri, 25 Feb 2011 08:58:01 +0100 Subject: Socket with no owner objects is deallocated immediately Till now the deallocation of such socket was delayed till zmq_term() thus creating a "leak". Signed-off-by: Martin Sustrik --- src/socket_base.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/socket_base.cpp') diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 2d366e8..6e07473 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -754,7 +754,21 @@ void zmq::socket_base_t::in_event () // Process any commands from other threads/sockets that may be available // at the moment. Ultimately, socket will be destroyed. process_commands (false, false); + check_destroy (); +} + +void zmq::socket_base_t::out_event () +{ + zmq_assert (false); +} + +void zmq::socket_base_t::timer_event (int id_) +{ + zmq_assert (false); +} +void zmq::socket_base_t::check_destroy () +{ // If the object was already marked as destroyed, finish the deallocation. if (destroyed) { @@ -771,13 +785,3 @@ void zmq::socket_base_t::in_event () own_t::process_destroy (); } } - -void zmq::socket_base_t::out_event () -{ - zmq_assert (false); -} - -void zmq::socket_base_t::timer_event (int id_) -{ - zmq_assert (false); -} -- cgit v1.2.3