Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
a146503d
Commit
a146503d
authored
May 27, 2015
by
Constantin Rack
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1409 from rikvdh/master
Fix another degradation, CPU maxes out when POLLOUT is set
parents
d8077bb3
aa2e74c2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
proxy.cpp
src/proxy.cpp
+14
-4
No files found.
src/proxy.cpp
View file @
a146503d
...
...
@@ -108,11 +108,15 @@ int zmq::proxy (
int
more
;
size_t
moresz
;
zmq_pollitem_t
items
[]
=
{
{
frontend_
,
0
,
ZMQ_POLLIN
|
ZMQ_POLLOUT
,
0
},
{
backend_
,
0
,
ZMQ_POLLIN
|
ZMQ_POLLOUT
,
0
},
{
frontend_
,
0
,
ZMQ_POLLIN
,
0
},
{
backend_
,
0
,
ZMQ_POLLIN
,
0
},
{
control_
,
0
,
ZMQ_POLLIN
,
0
}
};
int
qt_poll_items
=
(
control_
?
3
:
2
);
zmq_pollitem_t
itemsout
[]
=
{
{
frontend_
,
0
,
ZMQ_POLLOUT
,
0
},
{
backend_
,
0
,
ZMQ_POLLOUT
,
0
}
};
// Proxy can be in these three states
enum
{
...
...
@@ -127,6 +131,12 @@ int zmq::proxy (
if
(
unlikely
(
rc
<
0
))
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
;
// Process a control command if any
if
(
control_
&&
items
[
2
].
revents
&
ZMQ_POLLIN
)
{
rc
=
control_
->
recv
(
&
msg
,
0
);
...
...
@@ -160,7 +170,7 @@ int zmq::proxy (
// Process a request
if
(
state
==
active
&&
items
[
0
].
revents
&
ZMQ_POLLIN
&&
items
[
1
].
revents
&
ZMQ_POLLOUT
)
{
&&
items
out
[
1
].
revents
&
ZMQ_POLLOUT
)
{
rc
=
forward
(
frontend_
,
backend_
,
capture_
,
msg
);
if
(
unlikely
(
rc
<
0
))
return
-
1
;
...
...
@@ -168,7 +178,7 @@ int zmq::proxy (
// Process a reply
if
(
state
==
active
&&
items
[
1
].
revents
&
ZMQ_POLLIN
&&
items
[
0
].
revents
&
ZMQ_POLLOUT
)
{
&&
items
out
[
0
].
revents
&
ZMQ_POLLOUT
)
{
rc
=
forward
(
backend_
,
frontend_
,
capture_
,
msg
);
if
(
unlikely
(
rc
<
0
))
return
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment