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
6d776d08
Commit
6d776d08
authored
Mar 23, 2012
by
Ian Barber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #290 from pieterh/master
Fixed issue #325
parents
c861fb4c
ba798ee8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
18 deletions
+26
-18
zmq_setsockopt.txt
doc/zmq_setsockopt.txt
+3
-0
router.cpp
src/router.cpp
+23
-18
No files found.
doc/zmq_setsockopt.txt
View file @
6d776d08
...
...
@@ -133,6 +133,9 @@ identity.
Identity should be at least one byte and at most 255 bytes long. Identities
starting with binary zero are reserved for use by 0MQ infrastructure.
If two peers use the same identity when connecting to a third peer, the
results shall be undefined.
[horizontal]
Option value type:: binary data
Option value unit:: N/A
...
...
src/router.cpp
View file @
6d776d08
/*
Copyright (c) 2012 iMatix Corporation
Copyright (c) 2009-2011 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
...
...
@@ -106,6 +106,7 @@ void zmq::router_t::xterminated (pipe_t *pipe_)
return
;
}
}
// We should never get here
zmq_assert
(
false
);
}
...
...
@@ -236,25 +237,29 @@ int zmq::router_t::xrecv (msg_t *msg_, int flags_)
zmq_assert
(
!
more_in
);
// Empty identity means we can preserve the auto-generated identity.
if
(
msg_
->
size
()
!=
0
)
{
// Actual change of the identity.
outpipes_t
::
iterator
it
=
outpipes
.
begin
();
while
(
it
!=
outpipes
.
end
())
{
if
(
it
->
second
.
pipe
==
pipe
)
{
blob_t
identity
((
unsigned
char
*
)
msg_
->
data
(),
msg_
->
size
());
pipe
->
set_identity
(
identity
);
outpipes
.
erase
(
it
);
outpipe_t
outpipe
=
{
pipe
,
true
};
outpipes
.
insert
(
outpipes_t
::
value_type
(
identity
,
outpipe
));
break
;
// Empty identity means we can preserve the auto-generated identity
if
(
msg_
->
size
())
{
blob_t
identity
((
unsigned
char
*
)
msg_
->
data
(),
msg_
->
size
());
outpipes_t
::
iterator
it
=
outpipes
.
find
(
identity
);
if
(
it
==
outpipes
.
end
())
{
// Find the pipe and change its identity
bool
changed
=
false
;
it
=
outpipes
.
begin
();
while
(
it
!=
outpipes
.
end
())
{
if
(
it
->
second
.
pipe
==
pipe
)
{
pipe
->
set_identity
(
identity
);
outpipes
.
erase
(
it
);
outpipe_t
outpipe
=
{
pipe
,
true
};
if
(
!
outpipes
.
insert
(
outpipes_t
::
value_type
(
identity
,
outpipe
)).
second
)
zmq_assert
(
false
);
changed
=
true
;
break
;
}
++
it
;
}
++
it
;
zmq_assert
(
changed
)
;
}
zmq_assert
(
it
!=
outpipes
.
end
());
}
}
...
...
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