Sergey KHripchenko 057fab09a8 fixes for zmq_unbind() / zmq_disconnect() usage corner cases
1. when we call zmq_bind()/zmq_connect() to create endpoint
we send ourselfs(through launch_child()) command to process_own(endpoint)
(and add it to own_t::owned)
in the application thread we could call zmq_unbind() / zmq_disconnect() _BEFORE_
we run process_own() in ZMQ thread and in this situation we will be unable to find it in
own_t::owned. in other words own_t::owned.find(endpoint) will not be deleted but it will be deleted from
socket_base_t::endpoints.

2. when you zmq_unbind() the lisnening TCP/IPC socket was terminated only in destructor...
so the whole ZMQ_LINGER time listening TCP/IPC socket was able to accept() new connections
but unable to handle them.

this all geting even worse since unfortunately zmq has a bug and '*_listener_t' object not terminated
untill the socket's zmq_close().
AT LEAST FOR PUSH SOCKETS.
Everything is ok for SUB sockets.

Easy to reproduce without my fix:

zmq_socket(PUSH)
zmq_bind(tcp);
// connect to  it from PULL socket
zmq_unbind(tcp);

sleep(forever)

// netstat -anp | grep 'tcp listening socket'

With my fix you could see that after zmq_unbind(tcp) all previously connected tcp sessions
will not be finished untill the zmq_close(socket) regardless of ZMQ_LINGER value.

(*_listener_t terminates all owned session_base_t(connect=false) and they call pipe_t::terminate()
which in turn should call session_base_t::terminated() but this never happens)
2012-04-21 18:56:10 +04:00
..
2012-04-21 07:55:54 +04:00
2012-02-14 18:43:33 -06:00
2012-03-14 19:12:28 +04:00
2012-03-29 07:46:46 -05:00
2012-03-16 16:39:11 -05:00
2012-03-16 16:39:11 -05:00
2012-03-25 18:11:14 +01:00
2012-03-20 10:53:51 -05:00
2012-03-14 19:12:28 +04:00
2012-03-14 19:12:28 +04:00
2012-02-14 18:43:33 -06:00
2012-02-14 18:43:33 -06:00
2012-02-14 18:43:33 -06:00
2009-09-08 15:06:08 +02:00
2012-03-14 19:12:28 +04:00
2012-02-17 09:48:04 +00:00
2012-01-30 09:47:33 +01:00
2012-03-26 16:31:12 -05:00
2012-03-19 19:41:20 -05:00
2012-04-21 18:36:20 +04:00
2012-03-19 19:41:20 -05:00
2012-03-19 19:41:20 -05:00
2012-03-19 19:41:20 -05:00
2012-03-19 19:41:20 -05:00
2012-03-19 19:41:20 -05:00
2012-03-19 19:41:20 -05:00
2012-02-14 18:43:33 -06:00
2012-04-21 18:36:20 +04:00
2012-04-11 11:41:10 +02:00
2012-03-19 19:41:20 -05:00
2012-03-19 19:41:20 -05:00
2012-04-20 19:16:26 +04:00
2012-03-14 19:12:28 +04:00
2012-01-03 16:24:44 +01:00
2012-03-14 19:12:28 +04:00
2012-03-19 19:41:20 -05:00
2012-03-19 19:41:20 -05:00
2012-03-19 19:41:20 -05:00
2012-03-19 19:41:20 -05:00