[zeromq-dev] Abandon a multipart message?
algrant at acm.org
Wed Aug 8 13:55:42 CEST 2018
Is there a way to abandon a multipart message if for some reason
I can't complete sending all the parts? I.e.:
zmq_send(pubsock, ... ZMQ_SNDMORE)
... decide I don't want to send the rest of the message ...
zmq_abandon(pubsock); // does this exist
Without this, there's a risk that the next message sent - either a
single-part message with flags 0 or the first part of a multipart
message with ZMQ_SNDMORE - would be interpreted as the later
part of a multipart message.
An alternative way to do this would be to introduce a new send
flag meaning "first (or only) part of a message". If seen while
ZMQ_SNDMORE is outstanding it would abandon the previous
multipart message and release its resources (including calling
free-functions). This would be upwards compatible - flags 0 would
have its current meaning - but it would provide extra robustness
and the new ability to abandon sending multipart messages.
At the risk of bikeshedding, I'd suggest a flag ZMQ_SNDFIRST,
then ZMQ_SNDSINGLE could be an alias, with ZMQ_SNDMULTI
being defined as (ZMQ_SNDFIRST|ZMQ_SNDMORE).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the zeromq-dev