diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-03-20 17:37:04 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-03-20 17:37:04 +0100 |
commit | 0c99d04db9240f29493a4d774be677dc682547ca (patch) | |
tree | e3be78125bb01271dd7f172eaf6cfcc5f2afc08f | |
parent | 818d122d78e4b3bc55fdc376b43e15841b2e2006 (diff) |
Make REQ session state machine aware of reconnections
On reconnections, state machine in req_session_t is
reset to the initial state.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r-- | src/req.cpp | 6 | ||||
-rw-r--r-- | src/req.hpp | 1 | ||||
-rw-r--r-- | src/session_base.hpp | 6 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/req.cpp b/src/req.cpp index 01b35ea..2e0e614 100644 --- a/src/req.cpp +++ b/src/req.cpp @@ -179,3 +179,9 @@ int xs::req_session_t::write (msg_t *msg_) return -1; } +void xs::req_session_t::detach () +{ + state = options.recv_identity ? identity : bottom; + xreq_session_t::detach (); +} + diff --git a/src/req.hpp b/src/req.hpp index 10e06f2..0434ddd 100644 --- a/src/req.hpp +++ b/src/req.hpp @@ -72,6 +72,7 @@ namespace xs // Overloads of the functions from session_base_t. int write (msg_t *msg_); + void detach (); private: diff --git a/src/session_base.hpp b/src/session_base.hpp index 47da8c2..b22aee1 100644 --- a/src/session_base.hpp +++ b/src/session_base.hpp @@ -54,10 +54,12 @@ namespace xs void attach_pipe (xs::pipe_t *pipe_); // Following functions are the interface exposed towards the engine. + // They can be overloaded by specific session types to intercept + // events coming from the engine. virtual int read (msg_t *msg_); virtual int write (msg_t *msg_); - void flush (); - void detach (); + virtual void flush (); + virtual void detach (); // i_pipe_events interface implementation. void read_activated (xs::pipe_t *pipe_); |