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
804bce82
Commit
804bce82
authored
Nov 20, 2015
by
somdoron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pipe terimation in router while reading message
parent
4f7dc496
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
router.cpp
src/router.cpp
+26
-2
router.hpp
src/router.hpp
+6
-0
No files found.
src/router.cpp
View file @
804bce82
...
...
@@ -39,6 +39,8 @@ zmq::router_t::router_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t
(
parent_
,
tid_
,
sid_
),
prefetched
(
false
),
identity_sent
(
false
),
current_in
(
NULL
),
terminate_current_in
(
false
),
more_in
(
false
),
current_out
(
NULL
),
more_out
(
false
),
...
...
@@ -295,6 +297,14 @@ int zmq::router_t::xrecv (msg_t *msg_)
prefetched
=
false
;
}
more_in
=
msg_
->
flags
()
&
msg_t
::
more
?
true
:
false
;
if
(
!
more_in
)
{
if
(
terminate_current_in
)
{
current_in
->
terminate
(
true
);
terminate_current_in
=
false
;
}
current_in
=
NULL
;
}
return
0
;
}
...
...
@@ -313,8 +323,17 @@ int zmq::router_t::xrecv (msg_t *msg_)
zmq_assert
(
pipe
!=
NULL
);
// If we are in the middle of reading a message, just return the next part.
if
(
more_in
)
if
(
more_in
)
{
more_in
=
msg_
->
flags
()
&
msg_t
::
more
?
true
:
false
;
if
(
!
more_in
)
{
if
(
terminate_current_in
)
{
current_in
->
terminate
(
true
);
terminate_current_in
=
false
;
}
current_in
=
NULL
;
}
}
else
{
// We are at the beginning of a message.
// Keep the message part we have in the prefetch buffer
...
...
@@ -322,6 +341,7 @@ int zmq::router_t::xrecv (msg_t *msg_)
rc
=
prefetched_msg
.
move
(
*
msg_
);
errno_assert
(
rc
==
0
);
prefetched
=
true
;
current_in
=
pipe
;
blob_t
identity
=
pipe
->
get_identity
();
rc
=
msg_
->
init_size
(
identity
.
size
());
...
...
@@ -382,6 +402,7 @@ bool zmq::router_t::xhas_in ()
prefetched
=
true
;
identity_sent
=
false
;
current_in
=
pipe
;
return
true
;
}
...
...
@@ -466,7 +487,10 @@ bool zmq::router_t::identify_peer (pipe_t *pipe_)
// connection to take the identity.
outpipes
.
erase
(
it
);
existing_outpipe
.
pipe
->
terminate
(
true
);
if
(
existing_outpipe
.
pipe
==
current_in
)
terminate_current_in
=
true
;
else
existing_outpipe
.
pipe
->
terminate
(
true
);
}
}
}
...
...
src/router.hpp
View file @
804bce82
...
...
@@ -92,6 +92,12 @@ namespace zmq
// Holds the prefetched message.
msg_t
prefetched_msg
;
// The pipe we are currently reading from
zmq
::
pipe_t
*
current_in
;
// Should current_in should be terminate after all parts received?
bool
terminate_current_in
;
// If true, more incoming message parts are expected.
bool
more_in
;
...
...
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