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
4febe88b
Commit
4febe88b
authored
Dec 11, 2012
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #487 from miniway/master
returns -1 with EAGAIN when mandatory is set and pipe is full
parents
2a7b219f
a0cecc71
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
router.cpp
src/router.cpp
+6
-6
test_router_mandatory.cpp
tests/test_router_mandatory.cpp
+4
-5
No files found.
src/router.cpp
View file @
4febe88b
...
...
@@ -159,21 +159,21 @@ int zmq::router_t::xsend (msg_t *msg_)
// router_mandatory is set.
blob_t
identity
((
unsigned
char
*
)
msg_
->
data
(),
msg_
->
size
());
outpipes_t
::
iterator
it
=
outpipes
.
find
(
identity
);
bool
unreach
=
false
;
if
(
it
!=
outpipes
.
end
())
{
current_out
=
it
->
second
.
pipe
;
if
(
!
current_out
->
check_write
())
{
it
->
second
.
active
=
false
;
current_out
=
NULL
;
unreach
=
mandatory
?
true
:
false
;
if
(
mandatory
)
{
more_out
=
false
;
errno
=
EAGAIN
;
return
-
1
;
}
}
}
else
if
(
mandatory
)
unreach
=
true
;
if
(
unreach
)
{
if
(
mandatory
)
{
more_out
=
false
;
errno
=
EHOSTUNREACH
;
return
-
1
;
...
...
tests/test_router_mandatory.cpp
View file @
4febe88b
...
...
@@ -71,7 +71,7 @@ int main (void)
assert
(
rc
==
0
);
// wait until connect
zmq_sleep
(
1
);
zmq_sleep
(
1
);
// make it full and check that it fails
rc
=
zmq_send
(
sa
,
"X"
,
1
,
ZMQ_SNDMORE
);
...
...
@@ -79,18 +79,17 @@ int main (void)
rc
=
zmq_send
(
sa
,
"DATA1"
,
5
,
0
);
assert
(
rc
==
5
);
rc
=
zmq_send
(
sa
,
"X"
,
1
,
ZMQ_SNDMORE
);
rc
=
zmq_send
(
sa
,
"X"
,
1
,
ZMQ_SNDMORE
|
ZMQ_DONTWAIT
);
if
(
rc
==
1
)
{
// the first frame has been sent
rc
=
zmq_send
(
sa
,
"DATA2"
,
5
,
0
);
assert
(
rc
==
5
);
// send more
rc
=
zmq_send
(
sa
,
"X"
,
1
,
ZMQ_SNDMORE
);
rc
=
zmq_send
(
sa
,
"X"
,
1
,
ZMQ_SNDMORE
|
ZMQ_DONTWAIT
);
}
assert
(
rc
==
-
1
&&
errno
==
E
HOSTUNREACH
);
assert
(
rc
==
-
1
&&
errno
==
E
AGAIN
);
rc
=
zmq_close
(
sa
);
...
...
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