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
da1ef4d2
Commit
da1ef4d2
authored
May 08, 2011
by
Pieter Hintjens
Committed by
Martin Sustrik
May 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed REP assert on missing envelope
Signed-off-by:
Pieter Hintjens
<
ph@imatix.com
>
parent
0c5b781e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
6 deletions
+36
-6
rep.cpp
src/rep.cpp
+20
-6
xrep.cpp
src/xrep.cpp
+11
-0
xrep.hpp
src/xrep.hpp
+5
-0
No files found.
src/rep.cpp
View file @
da1ef4d2
...
...
@@ -67,24 +67,38 @@ int zmq::rep_t::xrecv (msg_t *msg_, int flags_)
if
(
request_begins
)
{
// Copy the backtrace stack to the reply pipe.
bool
bottom
=
false
;
while
(
!
bottom
)
{
while
(
true
)
{
// TODO:
What i
f request can be read but reply pipe is not
// ready for writing
?
// TODO:
I
f request can be read but reply pipe is not
// ready for writing
, we should drop the reply.
// Get next part of the backtrace stack.
int
rc
=
xrep_t
::
xrecv
(
msg_
,
flags_
);
if
(
rc
!=
0
)
return
rc
;
zmq_assert
(
msg_
->
flags
()
&
msg_t
::
more
);
if
(
msg_
->
flags
()
&
msg_t
::
more
)
{
// Empty message part delimits the traceback stack.
bottom
=
(
msg_
->
size
()
==
0
);
bool
bottom
=
(
msg_
->
size
()
==
0
);
// Push it to the reply pipe.
rc
=
xrep_t
::
xsend
(
msg_
,
flags_
);
zmq_assert
(
rc
==
0
);
// The end of the traceback, move to processing message body.
if
(
bottom
)
break
;
}
else
{
// If the traceback stack is malformed, discard anything
// already sent to pipe (we're at end of invalid message)
// and continue reading -- that'll switch us to the next pipe
// and next request.
rc
=
xrep_t
::
rollback
();
zmq_assert
(
rc
==
0
);
}
}
request_begins
=
false
;
...
...
src/xrep.cpp
View file @
da1ef4d2
...
...
@@ -289,6 +289,17 @@ int zmq::xrep_t::xrecv (msg_t *msg_, int flags_)
return
-
1
;
}
int
zmq
::
xrep_t
::
rollback
(
void
)
{
if
(
current_out
)
{
current_out
->
rollback
();
current_out
=
NULL
;
more_out
=
false
;
}
return
0
;
}
bool
zmq
::
xrep_t
::
xhas_in
()
{
// There are subsequent parts of the partly-read message available.
...
...
src/xrep.hpp
View file @
da1ef4d2
...
...
@@ -51,6 +51,11 @@ namespace zmq
bool
xhas_in
();
bool
xhas_out
();
protected
:
// Rollback any message parts that were sent but not yet flushed.
int
rollback
();
private
:
// Hook into the termination process.
...
...
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