[zeromq-dev] REQ sockets dropping messages from peers that weren't asked

Christian Kamm kamm at incasoftware.de
Fri Jul 5 18:36:01 CEST 2013


Hi,

I'd like to ask for review of this patch:
https://github.com/zeromq/libzmq/pull/608

I noticed the documentation in
http://rfc.zeromq.org/spec:28/REQREP
says that REQ sockets shall discard messages from peers that the current
request was not sent to. But tests showed that behavior wasn't
implemented. The change fixes that by keeping track of the pipe that the
request was sent to and discarding messages from other pipes until the
reply was received.

In zmq::req_t::xsend() I had to explicitly drop all messages currently
in the receive queue to avoid old messages from a peer being interpreted
as a new response. Calling recv in a send function looks odd - is this
an acceptable way of going about it?

Also: This could possibly break user code that relied on the previous,
odd behavior.

Cheers,
Christian



More information about the zeromq-dev mailing list