On Fri, 2017-12-01 at 18:08 +0200, Mykola Ostrovskyy via zeromq-dev
wrote:
> Hello,
> 
> I have a couple of threads that communicate via inproc:// PUSH/PULL
> sockets. The communication pattern does not map well to the order of
> thread
> creation, and out of convenience I have producer thread connecting to
> its
> PUSH socket before consumer thread has bound the PULL socket.
> 
> There is a note in the documentation [1], saying that for inproc://
> transport binding should be done before connecting. But that seems to
> work
> fine for me. I just left a comment in the code that this may cause
> some
> pain as a reminder, and decided not to fix what's not broken.
> 
> Today I had a broken communication issue, and the first suspect was
> this
> ordering of binding/connecting. Eventually I figured out that the
> problem
> was not related to ZMQ, but in the process did some digging in the
> code. In
> zmq::socket_base_t::bind() there is this piece of code:
> 
>     if (protocol == "inproc") {
>         const endpoint_t endpoint = { this, options };
>         rc = register_endpoint (addr_, endpoint);
>         if (rc == 0) {
>             connect_pending (addr_, this);
>             ...
> 
> This seems to assume that there can be pending connections to an
> unbound
> inproc:// socket.
> 
> Is the note in documentation still relevant? Are there some potential
> problems with doing zmq_connect() before zmq_bind()?
> 
> [1] http://api.zeromq.org/4-2:zmq-connect
> 
> 
> Regards,
> Mykola

Hi,

This was fixed in 4.2.0, connect-before-bind for inproc works fine now.
I guess the manpage needs an update, feel free to send a PR for it.

Kind regards,
Luca Boccassi

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to