Fixed issue #1695 (ZMQ_REQ_CORRELATE) #1862
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem: when using ZMQ_REQ_RELAXED + ZMQ_REQ_CORRELATE and two 'send' are executed in a row and no server is available at the time of the sends, then the internal request_id used to identify messages gets corrupted and the two messages end up with the same request_id. The correlation no longer works in that case and you may end up with the wrong message.
Solution: make a copy of the
request_id
instance member of thereq_t
class before sending it down the pipe.Issues #1690 and #1695 are linked: I also updated documentation to reflect the changes (there is no longer a disconnection of the peer when two sends in a row are sent from a relaxed REQ socket).
It seems I am the first to use
malloc()
on the ZMQ project: I hope this is ok! (I could not see a way around it).Thanks!