[zeromq-dev] subscribe/unsubscribe refcounting behaviour
Jon Dyte
jon at totient.co.uk
Tue Aug 17 23:28:41 CEST 2010
Hi
This is just a general question to the list about the behavior of the
subscribe/unsubscribe socket option.
Basically it seems that at present if you call subscribe multiple times
for the same prefix.
zmq::socket_t sm (ctx, ZMQ_SUB);
sm.setsockopt (ZMQ_SUBSCRIBE, "ABC", 3);
sm.setsockopt (ZMQ_SUBSCRIBE, "ABC", 3);
sm.setsockopt (ZMQ_SUBSCRIBE, "ABC", 3);
then the only way to cancel that subscription is to
sm.setsockopt (ZMQ_SUBSCRIBE, "ABC", 3);
sm.setsockopt (ZMQ_SUBSCRIBE, "ABC", 3);
sm.setsockopt (ZMQ_SUBSCRIBE, "ABC", 3);
the same number of times for the same prefix.
This means that the client has to keep track of how many subscriptions
it has issued in order to cancel it.
so
1) is everyone aware of this?
2) are they happy with it?
I only ask because I was rather surprised to see that this is the way it
currently works,
after studying the prefix/matching code recently.
Potentially the extra calls could both return an error to indicate
already subscribed or unsubscribed?
Thoughts?
Jon
More information about the zeromq-dev
mailing list