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
5c54bc35
Commit
5c54bc35
authored
Jun 10, 2013
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #573 from shripchenko/master
another iteration on ZMQ_PROBE_ROUTER
parents
6b8569d7
627190c8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
21 deletions
+16
-21
dealer.cpp
src/dealer.cpp
+2
-2
router.cpp
src/router.cpp
+13
-16
test_probe_router.cpp
tests/test_probe_router.cpp
+1
-3
No files found.
src/dealer.cpp
View file @
5c54bc35
...
...
@@ -44,8 +44,8 @@ void zmq::dealer_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
int
rc
=
probe_msg_
.
init
();
errno_assert
(
rc
==
0
);
int
ok
=
pipe_
->
write
(
&
probe_msg_
);
zmq_assert
(
ok
);
rc
=
pipe_
->
write
(
&
probe_msg_
);
// zmq_assert (rc) is not applicable here, since it is not a bug.
pipe_
->
flush
();
rc
=
probe_msg_
.
close
();
...
...
src/router.cpp
View file @
5c54bc35
...
...
@@ -59,6 +59,19 @@ void zmq::router_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
zmq_assert
(
pipe_
);
if
(
probe_router
)
{
msg_t
probe_msg_
;
int
rc
=
probe_msg_
.
init
();
errno_assert
(
rc
==
0
);
rc
=
pipe_
->
write
(
&
probe_msg_
);
// zmq_assert (rc) is not applicable here, since it is not a bug.
pipe_
->
flush
();
rc
=
probe_msg_
.
close
();
errno_assert
(
rc
==
0
);
}
bool
identity_ok
=
identify_peer
(
pipe_
);
if
(
identity_ok
)
fq
.
attach
(
pipe_
);
...
...
@@ -391,22 +404,6 @@ bool zmq::router_t::identify_peer (pipe_t *pipe_)
ok
=
outpipes
.
insert
(
outpipes_t
::
value_type
(
identity
,
outpipe
)).
second
;
zmq_assert
(
ok
);
if
(
probe_router
)
{
msg_t
probe_msg_
;
int
rc
=
probe_msg_
.
init
();
errno_assert
(
rc
==
0
);
ok
=
pipe_
->
write
(
&
probe_msg_
);
pipe_
->
flush
();
rc
=
probe_msg_
.
close
();
errno_assert
(
rc
==
0
);
// Ignore not probed peers
if
(
!
ok
)
return
false
;
}
return
true
;
}
...
...
tests/test_probe_router.cpp
View file @
5c54bc35
...
...
@@ -35,9 +35,7 @@ int main (void)
assert
(
rc
==
0
);
// Create client and connect to server, doing a probe
void
*
client
=
zmq_socket
(
ctx
,
ZMQ_DEALER
);
// Trying this results in the first recv waiting forever
// void *client = zmq_socket (ctx, ZMQ_ROUTER);
void
*
client
=
zmq_socket
(
ctx
,
ZMQ_ROUTER
);
assert
(
client
);
rc
=
zmq_setsockopt
(
client
,
ZMQ_IDENTITY
,
"X"
,
1
);
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