diff options
author | Martin Sustrik <sustrik@jozsi.(none)> | 2009-09-07 11:01:42 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@jozsi.(none)> | 2009-09-07 11:01:42 +0200 |
commit | d62c74232a4c1edd38004933afd0c7dc119bd98b (patch) | |
tree | 72881bf447ea1d29459b2cd32819dfd951a78797 /src/socket_base.cpp | |
parent | 11a6cb925f7ff3d17f48edccc886839b4d49ef0b (diff) | |
parent | 63b56d7fb38624c32111f9188d54b6fefb10a0e5 (diff) |
Merge branch 'master' of git://github.com/sustrik/zeromq2
Diffstat (limited to 'src/socket_base.cpp')
-rw-r--r-- | src/socket_base.cpp | 12 |
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; } |