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
cc295780
Commit
cc295780
authored
Jan 19, 2016
by
Constantin Rack
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1716 from somdoron/master
Problem: client over inproc receives the msg with routing id set
parents
e0fc5841
669c5697
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
5 deletions
+18
-5
msg.cpp
src/msg.cpp
+6
-0
msg.hpp
src/msg.hpp
+1
-0
server.cpp
src/server.cpp
+6
-1
test_client_server.cpp
tests/test_client_server.cpp
+5
-4
No files found.
src/msg.cpp
View file @
cc295780
...
...
@@ -512,6 +512,12 @@ int zmq::msg_t::set_routing_id (uint32_t routing_id_)
return
-
1
;
}
int
zmq
::
msg_t
::
reset_routing_id
()
{
u
.
base
.
routing_id
=
0
;
return
0
;
}
zmq
::
atomic_counter_t
*
zmq
::
msg_t
::
refcnt
()
{
switch
(
u
.
base
.
type
)
...
...
src/msg.hpp
View file @
cc295780
...
...
@@ -99,6 +99,7 @@ namespace zmq
bool
is_zcmsg
()
const
;
uint32_t
get_routing_id
();
int
set_routing_id
(
uint32_t
routing_id_
);
int
reset_routing_id
();
// After calling this function you can copy the message in POD-style
// refs_ times. No need to call copy.
...
...
src/server.cpp
View file @
cc295780
...
...
@@ -113,6 +113,11 @@ int zmq::server_t::xsend (msg_t *msg_)
errno
=
EHOSTUNREACH
;
return
-
1
;
}
// Message might be delivired over inproc, so we reset routing id
int
rc
=
msg_
->
reset_routing_id
();
errno_assert
(
rc
==
0
);
bool
ok
=
it
->
second
.
pipe
->
write
(
msg_
);
if
(
unlikely
(
!
ok
))
{
// Message failed to send - we must close it ourselves.
...
...
@@ -123,7 +128,7 @@ int zmq::server_t::xsend (msg_t *msg_)
it
->
second
.
pipe
->
flush
();
// Detach the message from the data buffer.
int
rc
=
msg_
->
init
();
rc
=
msg_
->
init
();
errno_assert
(
rc
==
0
);
return
0
;
...
...
tests/test_client_server.cpp
View file @
cc295780
...
...
@@ -38,10 +38,10 @@ int main (void)
void
*
server
=
zmq_socket
(
ctx
,
ZMQ_SERVER
);
void
*
client
=
zmq_socket
(
ctx
,
ZMQ_CLIENT
);
int
rc
=
zmq_bind
(
server
,
"
tcp://127.0.0.1:5560
"
);
int
rc
=
zmq_bind
(
server
,
"
inproc://test-client-server
"
);
assert
(
rc
==
0
);
rc
=
zmq_connect
(
client
,
"
tcp://127.0.0.1:5560
"
);
rc
=
zmq_connect
(
client
,
"
inproc://test-client-server
"
);
assert
(
rc
==
0
);
zmq_msg_t
msg
;
...
...
@@ -87,6 +87,9 @@ int main (void)
rc
=
zmq_msg_recv
(
&
msg
,
client
,
0
);
assert
(
rc
==
1
);
routing_id
=
zmq_msg_routing_id
(
&
msg
);
assert
(
routing_id
==
0
);
rc
=
zmq_msg_close
(
&
msg
);
assert
(
rc
==
0
);
...
...
@@ -101,5 +104,3 @@ int main (void)
return
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