diff options
author | Ernest Allen <eallen@apache.org> | 2015-06-10 17:11:49 +0000 |
---|---|---|
committer | Ernest Allen <eallen@apache.org> | 2015-06-10 17:11:49 +0000 |
commit | 465443a869a1d9ab16cf8109719b9c57a8af3219 (patch) | |
tree | d19c02795e814ee9a4ddf8c324bb09b53a852dbc | |
parent | 5f09dfc1ddb8c9b1f5943f62afec25f13c32815a (diff) | |
download | qpid-python-465443a869a1d9ab16cf8109719b9c57a8af3219.tar.gz |
QPID-6297: Python client should reconnect after network glitch
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1684716 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/broker/SessionManager.cpp | 5 | ||||
-rw-r--r-- | qpid/python/qpid/messaging/driver.py | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/qpid/cpp/src/qpid/broker/SessionManager.cpp b/qpid/cpp/src/qpid/broker/SessionManager.cpp index a2955f3bb0..a39cbab88a 100644 --- a/qpid/cpp/src/qpid/broker/SessionManager.cpp +++ b/qpid/cpp/src/qpid/broker/SessionManager.cpp @@ -47,11 +47,11 @@ SessionManager::~SessionManager() { detached.clear(); // Must clear before destructor as session dtor will call forget() } -std::auto_ptr<SessionState> SessionManager::attach(SessionHandler& h, const SessionId& id, bool/*force*/) { +std::auto_ptr<SessionState> SessionManager::attach(SessionHandler& h, const SessionId& id, bool force) { Mutex::ScopedLock l(lock); eraseExpired(); // Clean up expired table std::pair<Attached::iterator, bool> insert = attached.insert(id); - if (!insert.second) + if (!insert.second && !force) throw SessionBusyException(QPID_MSG("Session already attached: " << id)); Detached::iterator i = std::find(detached.begin(), detached.end(), id); std::auto_ptr<SessionState> state; @@ -62,7 +62,6 @@ std::auto_ptr<SessionState> SessionManager::attach(SessionHandler& h, const Ses state->attach(h); } return state; - // FIXME aconway 2008-04-29: implement force } void SessionManager::detach(std::auto_ptr<SessionState> session) { diff --git a/qpid/python/qpid/messaging/driver.py b/qpid/python/qpid/messaging/driver.py index 7c30e5d4ba..ff801c2282 100644 --- a/qpid/python/qpid/messaging/driver.py +++ b/qpid/python/qpid/messaging/driver.py @@ -591,6 +591,7 @@ class Engine: self.log_id = "%x" % id(self.connection) self._closing = False self._connected = False + self._reconnecting = bool(connection.sessions) self._attachments = {} self._in = LinkIn() @@ -874,8 +875,9 @@ class Engine: else: raise RuntimeError("all channels used") sst = SessionState(self, ssn, ssn.name, ch) - sst.write_op(SessionAttach(name=ssn.name)) + sst.write_op(SessionAttach(name=ssn.name, force=self._reconnecting)) sst.write_op(SessionCommandPoint(sst.sent, 0)) + self._reconnecting = False sst.outgoing_idx = 0 sst.acked = [] sst.acked_idx = 0 |