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
0e404ec8
Commit
0e404ec8
authored
Jan 16, 2015
by
KAPP Arnaud
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1309 from rodgert/master
Add 'Peer-Address' property to connection metadata
parents
2e76bbe4
cf2bd3b6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
12 deletions
+16
-12
.gitignore
.gitignore
+1
-0
zmq_msg_gets.txt
doc/zmq_msg_gets.txt
+4
-0
stream_engine.cpp
src/stream_engine.cpp
+8
-11
test_metadata.cpp
tests/test_metadata.cpp
+3
-1
No files found.
.gitignore
View file @
0e404ec8
...
...
@@ -137,3 +137,4 @@ zeromq-*.tar.gz
zeromq-*.zip
core
build
test-suite.log
doc/zmq_msg_gets.txt
View file @
0e404ec8
...
...
@@ -29,6 +29,10 @@ function:
Identity
Resource
Additionally, when available for the underlying transport, the *Peer-Address*
property will return the IP address of the remote endpoint as returned by
getnameinfo(2).
Other properties may be defined based on the underlying security, see ZAP
auththenticated connection sample below.
...
...
src/stream_engine.cpp
View file @
0e404ec8
...
...
@@ -671,7 +671,7 @@ bool zmq::stream_engine_t::handshake ()
options
.
mechanism
==
ZMQ_GSSAPI
?
"GSSAPI"
:
"OTHER"
,
mechanism
);
error
(
protocol_error
);
return
false
;
}
...
...
@@ -806,21 +806,18 @@ void zmq::stream_engine_t::mechanism_ready ()
properties_t
properties
;
properties_t
::
const_iterator
it
;
// If we have a peer_address, add it to metadata
if
(
!
peer_address
.
empty
())
{
properties
.
insert
(
std
::
make_pair
(
"Peer-Address"
,
peer_address
));
}
// Add ZAP properties.
const
properties_t
&
zap_properties
=
mechanism
->
get_zap_properties
();
it
=
zap_properties
.
begin
();
while
(
it
!=
zap_properties
.
end
())
{
properties
.
insert
(
properties_t
::
value_type
(
it
->
first
,
it
->
second
));
++
it
;
}
properties
.
insert
(
zap_properties
.
begin
(),
zap_properties
.
end
());
// Add ZMTP properties.
const
properties_t
&
zmtp_properties
=
mechanism
->
get_zmtp_properties
();
it
=
zmtp_properties
.
begin
();
while
(
it
!=
zmtp_properties
.
end
())
{
properties
.
insert
(
properties_t
::
value_type
(
it
->
first
,
it
->
second
));
++
it
;
}
properties
.
insert
(
zmtp_properties
.
begin
(),
zmtp_properties
.
end
());
zmq_assert
(
metadata
==
NULL
);
if
(
!
properties
.
empty
())
...
...
tests/test_metadata.cpp
View file @
0e404ec8
...
...
@@ -41,7 +41,7 @@ zap_handler (void *handler)
assert
(
streq
(
version
,
"1.0"
));
assert
(
streq
(
mechanism
,
"NULL"
));
s_sendmore
(
handler
,
version
);
s_sendmore
(
handler
,
sequence
);
if
(
streq
(
domain
,
"DOMAIN"
))
{
...
...
@@ -100,6 +100,8 @@ int main (void)
assert
(
streq
(
zmq_msg_gets
(
&
msg
,
"Hello"
),
"World"
));
assert
(
streq
(
zmq_msg_gets
(
&
msg
,
"Socket-Type"
),
"DEALER"
));
assert
(
streq
(
zmq_msg_gets
(
&
msg
,
"User-Id"
),
"anonymous"
));
assert
(
streq
(
zmq_msg_gets
(
&
msg
,
"Peer-Address"
),
"127.0.0.1"
));
assert
(
zmq_msg_gets
(
&
msg
,
"No Such"
)
==
NULL
);
assert
(
zmq_errno
()
==
EINVAL
);
zmq_msg_close
(
&
msg
);
...
...
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