[zeromq-dev] Mac OS X: test_shutdown_stress sometimes fails

Martin Sustrik sustrik at 250bpm.com
Mon Dec 6 13:38:52 CET 2010

Hi Dhammika,

>>> Patch attached.
>> I've checked the patch. Shouldn't the 'dispatch' be called when the engine
>> is actually being moved to another thread (inside finalise_initialisation
>> function) rather than in 'read' function?

I still feel there's something wrong with the patch. Let me explain.

The initialisation is ended when both your identity is sent and peer's 
identity is received. The two events can happen in whatever order (in 
most cases the send happens immediately, while recv happens later on, 
but that's not 100% guaranteed).

Thus, finalise_initialisation function is called both in read() and 
flush() i.e. twice for each connection establishment.

The code inside finalise_initialisation checks whether both events have 
already happened:

     if (sent && received) ...

and if so, it proceeds. Otherwise it does nothing.

Now, in the patch the sending are receiving are handled differently. In 
one case finalise_initialisation is called, in the other dispatch_engine.

I don't see the reason for keeping the behaviour asymetric.

Maybe I'm missing something?


More information about the zeromq-dev mailing list