mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-09 15:26:04 +00:00
don't check POLLOUT for single-socket proxies
This commit is contained in:
parent
d3bb450892
commit
158d77d63e
@ -142,10 +142,14 @@ int zmq::proxy (
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Get the pollout separately because when combining this with pollin it maxes the CPU
|
// Get the pollout separately because when combining this with pollin it maxes the CPU
|
||||||
// because pollout shall most of the time return directly
|
// because pollout shall most of the time return directly.
|
||||||
rc = zmq_poll (&itemsout [0], 2, 0);
|
// POLLOUT is only checked when frontend and backend sockets are not the same.
|
||||||
if (unlikely (rc < 0))
|
if (frontend_ != backend_) {
|
||||||
return -1;
|
rc = zmq_poll (&itemsout [0], 2, 0);
|
||||||
|
if (unlikely (rc < 0)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Process a control command if any
|
// Process a control command if any
|
||||||
if (control_ && items [2].revents & ZMQ_POLLIN) {
|
if (control_ && items [2].revents & ZMQ_POLLIN) {
|
||||||
@ -180,13 +184,14 @@ int zmq::proxy (
|
|||||||
// Process a request
|
// Process a request
|
||||||
if (state == active
|
if (state == active
|
||||||
&& items [0].revents & ZMQ_POLLIN
|
&& items [0].revents & ZMQ_POLLIN
|
||||||
&& itemsout [1].revents & ZMQ_POLLOUT) {
|
&& (frontend_ == backend_ || itemsout [1].revents & ZMQ_POLLOUT)) {
|
||||||
rc = forward(frontend_, backend_, capture_,msg);
|
rc = forward(frontend_, backend_, capture_,msg);
|
||||||
if (unlikely (rc < 0))
|
if (unlikely (rc < 0))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Process a reply
|
// Process a reply
|
||||||
if (state == active
|
if (state == active
|
||||||
|
&& frontend_ != backend_
|
||||||
&& items [1].revents & ZMQ_POLLIN
|
&& items [1].revents & ZMQ_POLLIN
|
||||||
&& itemsout [0].revents & ZMQ_POLLOUT) {
|
&& itemsout [0].revents & ZMQ_POLLOUT) {
|
||||||
rc = forward(backend_, frontend_, capture_,msg);
|
rc = forward(backend_, frontend_, capture_,msg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user