mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-09 07:16: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;
|
||||
|
||||
// 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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user