[zeromq-dev] [PATCH] REQ socket discards duplicate replies

Martin Sustrik sustrik at 250bpm.com
Tue Jun 21 15:35:57 CEST 2011

On 06/21/2011 03:20 PM, Ian Barber wrote:

> Not sure that there needs to be anything particularly fancy about the
> random numbers, being that we're already using UUIDs elsewhere I can't
> see how that would hurt unless generating is expensive.

Generating UUIDs is expensive in this case because the request IDs have 
to be generated per message (as opposed to per connection). Thus, what 
the code does now is it combines 4 random bytes generated on 
per-connection basis and 4 byte counter of requests.

> What is the plan
> for duplicate removal? Is it just going to be of previous reply, or a
> window of previous replies?

REQ socket can have at most one request on the fly so there's no need 
for a window.

It's a prerequisite for auto-resend functionality in REQ socket. If 
request timeouts and resends we may get several replies and we need to 
discard the duplicates.

> Small comment typo:
> //  od congestion, we should drop it.

Good spot.


More information about the zeromq-dev mailing list