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?

Martin
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to