Commit 158d77d6 authored by Min RK's avatar Min RK

don't check POLLOUT for single-socket proxies

parent d3bb4508
......@@ -142,10 +142,14 @@ int zmq::proxy (
return -1;
// Get the pollout separately because when combining this with pollin it maxes the CPU
// because pollout shall most of the time return directly
rc = zmq_poll (&itemsout [0], 2, 0);
if (unlikely (rc < 0))
return -1;
// because pollout shall most of the time return directly.
// POLLOUT is only checked when frontend and backend sockets are not the same.
if (frontend_ != backend_) {
rc = zmq_poll (&itemsout [0], 2, 0);
if (unlikely (rc < 0)) {
return -1;
}
}
// Process a control command if any
if (control_ && items [2].revents & ZMQ_POLLIN) {
......@@ -180,13 +184,14 @@ int zmq::proxy (
// Process a request
if (state == active
&& items [0].revents & ZMQ_POLLIN
&& itemsout [1].revents & ZMQ_POLLOUT) {
&& (frontend_ == backend_ || itemsout [1].revents & ZMQ_POLLOUT)) {
rc = forward(frontend_, backend_, capture_,msg);
if (unlikely (rc < 0))
return -1;
}
// Process a reply
if (state == active
&& frontend_ != backend_
&& items [1].revents & ZMQ_POLLIN
&& itemsout [0].revents & ZMQ_POLLOUT) {
rc = forward(backend_, frontend_, capture_,msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment