Merge pull request #352 from hurtonm/issue_370

Fix issue #370
This commit is contained in:
Pieter Hintjens 2012-05-29 13:29:58 -07:00
commit 1adb7b1017
4 changed files with 15 additions and 3 deletions

View File

@ -178,3 +178,8 @@ int zmq::req_session_t::write (msg_t *msg_)
return -1;
}
void zmq::req_session_t::reset ()
{
session_base_t::reset ();
state = identity;
}

View File

@ -72,6 +72,7 @@ namespace zmq
// Overloads of the functions from session_base_t.
int write (msg_t *msg_);
void reset ();
private:

View File

@ -190,6 +190,13 @@ int zmq::session_base_t::write (msg_t *msg_)
return -1;
}
void zmq::session_base_t::reset ()
{
// Restore identity flags.
send_identity = options.send_identity;
recv_identity = options.recv_identity;
}
void zmq::session_base_t::flush ()
{
if (pipe)
@ -388,9 +395,7 @@ void zmq::session_base_t::detached ()
return;
}
// Restore identity flags.
send_identity = options.send_identity;
recv_identity = options.recv_identity;
reset ();
// Reconnect.
if (options.reconnect_ivl != -1)

View File

@ -56,6 +56,7 @@ namespace zmq
// Following functions are the interface exposed towards the engine.
virtual int read (msg_t *msg_);
virtual int write (msg_t *msg_);
virtual void reset ();
void flush ();
void detach ();