Skip to content
Browse files

Never exchange identities for sockets in raw mode

Zeromq shall never send/receive socket identifiers for sockets in raw
mode. The existing implementation breaks this requirement after
reconnection.
  • Loading branch information...
1 parent aec47b3 commit c1e960b31d0a2ffdcb3016e7301b9da5ca612493 @hurtonm hurtonm committed Nov 8, 2012
Showing with 6 additions and 9 deletions.
  1. +6 −9 src/session_base.cpp
View
15 src/session_base.cpp
@@ -120,11 +120,6 @@ zmq::session_base_t::session_base_t (class io_thread_t *io_thread_,
identity_received (false),
addr (addr_)
{
- // Identities are not exchanged for raw sockets
- if (options.raw_sock) {
- identity_sent = true;
- identity_received = true;
- }
}
zmq::session_base_t::~session_base_t ()
@@ -156,8 +151,9 @@ void zmq::session_base_t::attach_pipe (pipe_t *pipe_)
int zmq::session_base_t::pull_msg (msg_t *msg_)
{
- // First message to send is identity
- if (unlikely (!identity_sent)) {
+ // Unless the socket is in raw mode, the first
+ // message we send is its identity.
+ if (unlikely (!identity_sent && !options.raw_sock)) {
int rc = msg_->init_size (options.identity_size);
errno_assert (rc == 0);
memcpy (msg_->data (), options.identity, options.identity_size);
@@ -177,8 +173,9 @@ int zmq::session_base_t::pull_msg (msg_t *msg_)
int zmq::session_base_t::push_msg (msg_t *msg_)
{
- // First message to receive is identity
- if (unlikely (!identity_received)) {
+ // Unless the socket is in raw mode, the first
+ // message we receive is its identity.
+ if (unlikely (!identity_received && !options.raw_sock)) {
msg_->set_flags (msg_t::identity);
identity_received = true;
if (!options.recv_identity) {

0 comments on commit c1e960b

Please sign in to comment.
Something went wrong with that request. Please try again.