Pieter,

> - Martin points out that the calling thread is sleeping, not
> processing commands, so it's normal that the mailbox backs up.

Here's a patch that should alleviate the problem in this specific use case.

It make zmq_init_t object (the one that handles initial exchange of 
identities) a child of zmq_listener_t object (one that waits for new 
connections) instead of being direct child of the socket object.

Thus the init's startup and teardown handshaking happens between init 
object and listener object. Both of those live in I/O thread and are 
able to process the commands immediately -- there's no way user can 
block the processing.

The application thread's mailbox would thus get *no* commands when new 
connection is created, identities are exchanged and the connection is 
dropped subsequently because of duplicit identity.

diff --git a/src/zmq_listener.cpp b/src/zmq_listener.cpp
index 522ab3f..2a7f1eb 100644
--- a/src/zmq_listener.cpp
+++ b/src/zmq_listener.cpp
@@ -72,6 +72,6 @@ void zmq::zmq_listener_t::in_event ()
      zmq_init_t *init = new (std::nothrow) zmq_init_t (io_thread, socket,
          NULL, fd, options);
      zmq_assert (init);
-    launch_sibling (init);
+    launch_child (init);
  }

Martin
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to