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
d4cc5923
Commit
d4cc5923
authored
Dec 23, 2019
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: loop variable modified in loop step and body
Solution: modify it in loop body only
parent
a64c3e6c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
dist.cpp
src/dist.cpp
+12
-5
No files found.
src/dist.cpp
View file @
d4cc5923
...
...
@@ -171,9 +171,13 @@ void zmq::dist_t::distribute (msg_t *msg_)
}
if
(
msg_
->
is_vsm
())
{
for
(
pipes_t
::
size_type
i
=
0
;
i
<
_matching
;
++
i
)
if
(
!
write
(
_pipes
[
i
],
msg_
))
--
i
;
// Retry last write because index will have been swapped
for
(
pipes_t
::
size_type
i
=
0
;
i
<
_matching
;)
{
if
(
!
write
(
_pipes
[
i
],
msg_
))
{
// Use same index again because entry will have been removed.
}
else
{
++
i
;
}
}
int
rc
=
msg_
->
close
();
errno_assert
(
rc
==
0
);
rc
=
msg_
->
init
();
...
...
@@ -187,11 +191,14 @@ void zmq::dist_t::distribute (msg_t *msg_)
// Push copy of the message to each matching pipe.
int
failed
=
0
;
for
(
pipes_t
::
size_type
i
=
0
;
i
<
_matching
;
++
i
)
for
(
pipes_t
::
size_type
i
=
0
;
i
<
_matching
;
)
{
if
(
!
write
(
_pipes
[
i
],
msg_
))
{
++
failed
;
--
i
;
// Retry last write because index will have been swapped
// Use same index again because entry will have been removed.
}
else
{
++
i
;
}
}
if
(
unlikely
(
failed
))
msg_
->
rm_refs
(
failed
);
...
...
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