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
12833804
Commit
12833804
authored
Aug 12, 2012
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #409 from hurtonm/master
Exchange greeting messages for all socket types
parents
b32542e3
1ab85f47
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
22 deletions
+23
-22
dealer.cpp
src/dealer.cpp
+0
-1
options.cpp
src/options.cpp
+0
-1
options.hpp
src/options.hpp
+1
-4
router.cpp
src/router.cpp
+0
-1
session_base.cpp
src/session_base.cpp
+17
-10
session_base.hpp
src/session_base.hpp
+3
-3
socket_base.cpp
src/socket_base.cpp
+2
-2
No files found.
src/dealer.cpp
View file @
12833804
...
...
@@ -35,7 +35,6 @@ zmq::dealer_t::dealer_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
// be noone to receive the replies anyway.
// options.delay_on_close = false;
options
.
send_identity
=
true
;
options
.
recv_identity
=
true
;
prefetched_msg
.
init
();
...
...
src/options.cpp
View file @
12833804
...
...
@@ -48,7 +48,6 @@ zmq::options_t::options_t () :
delay_on_close
(
true
),
delay_on_disconnect
(
true
),
filter
(
false
),
send_identity
(
false
),
recv_identity
(
false
),
tcp_keepalive
(
-
1
),
tcp_keepalive_cnt
(
-
1
),
...
...
src/options.hpp
View file @
12833804
...
...
@@ -112,10 +112,7 @@ namespace zmq
// If 1, (X)SUB socket should filter the messages. If 0, it should not.
bool
filter
;
// Sends identity to all new connections.
bool
send_identity
;
// Receivers identity from all new connections.
// If true, the identity message is forwarded to the socket.
bool
recv_identity
;
// TCP keep-alive settings.
...
...
src/router.cpp
View file @
12833804
...
...
@@ -45,7 +45,6 @@ zmq::router_t::router_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
// all the outstanding requests from that peer.
// options.delay_on_disconnect = false;
options
.
send_identity
=
true
;
options
.
recv_identity
=
true
;
prefetched_id
.
init
();
...
...
src/session_base.cpp
View file @
12833804
...
...
@@ -117,8 +117,8 @@ zmq::session_base_t::session_base_t (class io_thread_t *io_thread_,
socket
(
socket_
),
io_thread
(
io_thread_
),
has_linger_timer
(
false
),
send_identity
(
options_
.
send_identity
),
recv_identity
(
options_
.
recv_identity
),
identity_sent
(
false
),
identity_received
(
false
),
addr
(
addr_
)
{
}
...
...
@@ -152,13 +152,13 @@ void zmq::session_base_t::attach_pipe (pipe_t *pipe_)
int
zmq
::
session_base_t
::
read
(
msg_t
*
msg_
)
{
// First message to send is identity
(if required).
if
(
send_identity
)
{
// First message to send is identity
if
(
!
identity_sent
)
{
zmq_assert
(
!
(
msg_
->
flags
()
&
msg_t
::
more
));
int
rc
=
msg_
->
init_size
(
options
.
identity_size
);
errno_assert
(
rc
==
0
);
memcpy
(
msg_
->
data
(),
options
.
identity
,
options
.
identity_size
);
send_identity
=
fals
e
;
identity_sent
=
tru
e
;
incomplete_in
=
false
;
return
0
;
}
...
...
@@ -174,10 +174,17 @@ int zmq::session_base_t::read (msg_t *msg_)
int
zmq
::
session_base_t
::
write
(
msg_t
*
msg_
)
{
// First message to receive is identity
(if required).
if
(
recv_identity
)
{
// First message to receive is identity
if
(
!
identity_received
)
{
msg_
->
set_flags
(
msg_t
::
identity
);
recv_identity
=
false
;
identity_received
=
true
;
if
(
!
options
.
recv_identity
)
{
int
rc
=
msg_
->
close
();
errno_assert
(
rc
==
0
);
rc
=
msg_
->
init
();
errno_assert
(
rc
==
0
);
return
0
;
}
}
if
(
pipe
&&
pipe
->
write
(
msg_
))
{
...
...
@@ -193,8 +200,8 @@ int zmq::session_base_t::write (msg_t *msg_)
void
zmq
::
session_base_t
::
reset
()
{
// Restore identity flags.
send_identity
=
options
.
send_identity
;
recv_identity
=
options
.
recv_identity
;
identity_sent
=
false
;
identity_received
=
false
;
}
void
zmq
::
session_base_t
::
flush
()
...
...
src/session_base.hpp
View file @
12833804
...
...
@@ -130,9 +130,9 @@ namespace zmq
// True is linger timer is running.
bool
has_linger_timer
;
// If true, identity
is to be sent/recv
d from the network.
bool
send_identity
;
bool
recv_identity
;
// If true, identity
has been sent/receive
d from the network.
bool
identity_sent
;
bool
identity_received
;
// Protocol and address to use when connecting.
const
address_t
*
addr
;
...
...
src/socket_base.cpp
View file @
12833804
...
...
@@ -448,7 +448,7 @@ int zmq::socket_base_t::connect (const char *addr_)
attach_pipe
(
pipes
[
0
]);
// If required, send the identity of the local socket to the peer.
if
(
options
.
send
_identity
)
{
if
(
peer
.
options
.
recv
_identity
)
{
msg_t
id
;
rc
=
id
.
init_size
(
options
.
identity_size
);
errno_assert
(
rc
==
0
);
...
...
@@ -460,7 +460,7 @@ int zmq::socket_base_t::connect (const char *addr_)
}
// If required, send the identity of the peer to the local socket.
if
(
peer
.
options
.
send
_identity
)
{
if
(
options
.
recv
_identity
)
{
msg_t
id
;
rc
=
id
.
init_size
(
peer
.
options
.
identity_size
);
errno_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