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
cda20260
Commit
cda20260
authored
Aug 29, 2017
by
sigiesec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: missing call to zmq_poller_destroy
Solution: added call
parent
f4d139bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
test_router_mandatory.cpp
tests/test_router_mandatory.cpp
+17
-1
No files found.
tests/test_router_mandatory.cpp
View file @
cda20260
...
...
@@ -65,13 +65,24 @@ void test_get_peer_state ()
rc
=
zmq_connect
(
dealer2
,
my_endpoint
);
assert
(
rc
==
0
);
// Get message from
dealer
to know when connection is ready
// Get message from
both dealers
to know when connection is ready
char
buffer
[
255
];
rc
=
zmq_send
(
dealer1
,
"Hello"
,
5
,
0
);
assert
(
rc
==
5
);
rc
=
zmq_recv
(
router
,
buffer
,
255
,
0
);
assert
(
rc
==
1
);
assert
(
buffer
[
0
]
==
'X'
);
rc
=
zmq_recv
(
router
,
buffer
,
255
,
0
);
assert
(
rc
==
5
);
rc
=
zmq_send
(
dealer2
,
"Hello"
,
5
,
0
);
assert
(
rc
==
5
);
rc
=
zmq_recv
(
router
,
buffer
,
255
,
0
);
assert
(
rc
==
1
);
assert
(
buffer
[
0
]
==
'Y'
);
rc
=
zmq_recv
(
router
,
buffer
,
255
,
0
);
assert
(
rc
==
5
);
void
*
poller
=
zmq_poller_new
();
assert
(
poller
);
...
...
@@ -92,6 +103,8 @@ void test_get_peer_state ()
for
(
size_t
i
=
0
;
i
<
event_size
;
++
i
)
{
if
(
events
[
i
].
socket
==
router
)
{
rc
=
zmq_socket_get_peer_state
(
router
,
"X"
,
1
);
if
(
rc
==
-
1
)
printf
(
"zmq_socket_get_peer_state failed: %i
\n
"
,
errno
);
assert
(
rc
!=
-
1
);
if
(
rc
&
ZMQ_POLLOUT
)
{
rc
=
zmq_send
(
router
,
"X"
,
1
,
ZMQ_SNDMORE
);
...
...
@@ -100,6 +113,8 @@ void test_get_peer_state ()
assert
(
rc
==
5
);
}
rc
=
zmq_socket_get_peer_state
(
router
,
"Y"
,
1
);
if
(
rc
==
-
1
)
printf
(
"zmq_socket_get_peer_state failed: %i
\n
"
,
errno
);
assert
(
rc
!=
-
1
);
if
(
rc
&
ZMQ_POLLOUT
)
{
rc
=
zmq_send
(
router
,
"Y"
,
1
,
ZMQ_SNDMORE
);
...
...
@@ -115,6 +130,7 @@ void test_get_peer_state ()
// never read from dealer2, so its pipe becomes full eventually
}
}
zmq_poller_destroy
(
&
poller
);
rc
=
zmq_close
(
router
);
assert
(
rc
==
0
);
...
...
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