summaryrefslogtreecommitdiff
path: root/src/socket_base.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-09-04 16:02:41 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-09-04 16:02:41 +0200
commit4307baf7bcc71ca91da0175e79cdfbf6cc1ad770 (patch)
treee4d5e5b663e6e98d21e9aa7f7ff180bbbbb71593 /src/socket_base.cpp
parent450b31c3b263ee6ceea27517a2a969d0c74bcd7e (diff)
python binding functional
Diffstat (limited to 'src/socket_base.cpp')
-rw-r--r--src/socket_base.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/socket_base.cpp b/src/socket_base.cpp
index 6ad1f55..93a0a4c 100644
--- a/src/socket_base.cpp
+++ b/src/socket_base.cpp
@@ -24,7 +24,7 @@
#include "socket_base.hpp"
#include "app_thread.hpp"
-#include "err.hpp"
+#include "dispatcher.hpp"
#include "zmq_listener.hpp"
#include "zmq_connecter.hpp"
#include "msg_content.hpp"
@@ -34,6 +34,7 @@
#include "owned.hpp"
#include "uuid.hpp"
#include "pipe.hpp"
+#include "err.hpp"
zmq::socket_base_t::socket_base_t (app_thread_t *parent_) :
object_t (parent_),
@@ -288,7 +289,16 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
int zmq::socket_base_t::close ()
{
app_thread->remove_socket (this);
+
+ // Pointer to the dispatcher must be retrieved before the socket is
+ // deallocated. Afterwards it is not available.
+ dispatcher_t *dispatcher = get_dispatcher ();
delete this;
+
+ // This function must be called after the socket is completely deallocated
+ // as it may cause termination of the whole 0MQ infrastructure.
+ dispatcher->destroy_socket ();
+
return 0;
}