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
1f229547
Commit
1f229547
authored
Jul 31, 2012
by
Ian Barber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #406 from hurtonm/master
Fix issue #406
parents
84560c16
9fab9937
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
msg.cpp
src/msg.cpp
+5
-0
msg.hpp
src/msg.hpp
+1
-0
router.cpp
src/router.cpp
+18
-7
No files found.
src/msg.cpp
View file @
1f229547
...
...
@@ -232,6 +232,11 @@ void zmq::msg_t::reset_flags (unsigned char flags_)
u
.
base
.
flags
&=
~
flags_
;
}
bool
zmq
::
msg_t
::
is_identity
()
const
{
return
(
u
.
base
.
flags
&
identity
)
==
identity
;
}
bool
zmq
::
msg_t
::
is_delimiter
()
{
return
u
.
base
.
type
==
type_delimiter
;
...
...
src/msg.hpp
View file @
1f229547
...
...
@@ -69,6 +69,7 @@ namespace zmq
unsigned
char
flags
();
void
set_flags
(
unsigned
char
flags_
);
void
reset_flags
(
unsigned
char
flags_
);
bool
is_identity
()
const
;
bool
is_delimiter
();
bool
is_vsm
();
...
...
src/router.cpp
View file @
1f229547
...
...
@@ -211,13 +211,17 @@ int zmq::router_t::xrecv (msg_t *msg_, int flags_)
pipe_t
*
pipe
=
NULL
;
int
rc
=
fq
.
recvpipe
(
msg_
,
&
pipe
);
if
(
rc
!=
0
)
{
errno
=
EAGAIN
;
// It's possible that we receive peer's identity. That happens
// after reconnection. The current implementation assumes that
// the peer always uses the same identity.
// TODO: handle the situation when the peer changes its identity.
while
(
rc
==
0
&&
msg_
->
is_identity
())
rc
=
fq
.
recvpipe
(
msg_
,
&
pipe
);
if
(
rc
!=
0
)
return
-
1
;
}
// Identity is not expected
zmq_assert
((
msg_
->
flags
()
&
msg_t
::
identity
)
==
0
);
zmq_assert
(
pipe
!=
NULL
);
// If we are in the middle of reading a message, just return the next part.
...
...
@@ -267,11 +271,18 @@ bool zmq::router_t::xhas_in ()
// The message, if read, is kept in the pre-fetch buffer.
pipe_t
*
pipe
=
NULL
;
int
rc
=
fq
.
recvpipe
(
&
prefetched_msg
,
&
pipe
);
// It's possible that we receive peer's identity. That happens
// after reconnection. The current implementation assumes that
// the peer always uses the same identity.
// TODO: handle the situation when the peer changes its identity.
while
(
rc
==
0
&&
prefetched_msg
.
is_identity
())
rc
=
fq
.
recvpipe
(
&
prefetched_msg
,
&
pipe
);
if
(
rc
!=
0
)
return
false
;
// Identity is not expected
zmq_assert
((
prefetched_msg
.
flags
()
&
msg_t
::
identity
)
==
0
);
zmq_assert
(
pipe
!=
NULL
);
blob_t
identity
=
pipe
->
get_identity
();
rc
=
prefetched_id
.
init_size
(
identity
.
size
());
...
...
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