allow duplicate entries in zmq_poller_poll

This should restore full compatibility with earlier zmq_poll behavior.

It complicates things a little bit, as collisions must be detected, and when collisions are found:

- event masks must be merged
- pollitems, events arrays are no longer co-ordered

Reverts the recent zmq_proxy patch to workaround the lack of repeat-item support in zmq_poll that is now fixed.
This commit is contained in:
Min RK
2016-09-29 16:15:15 +02:00
parent ae0676e80d
commit fb5a04e21d
2 changed files with 54 additions and 23 deletions

View File

@@ -130,15 +130,6 @@ int zmq::proxy (
{ backend_, 0, ZMQ_POLLOUT, 0 }
};
int control_idx = 2;
if (frontend_ == backend_) {
// when frontend & backend are the same,
// avoid duplicate poll entries
qt_poll_items -= 1;
items[1] = items[2];
control_idx = 1;
}
// Proxy can be in these three states
enum {
active,
@@ -163,7 +154,7 @@ int zmq::proxy (
}
// Process a control command if any
if (control_ && items [control_idx].revents & ZMQ_POLLIN) {
if (control_ && items [2].revents & ZMQ_POLLIN) {
rc = control_->recv (&msg, 0);
if (unlikely (rc < 0))
return -1;