From 1896a5d32c87555877edd1dafc1bd34e3fcf5683 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 8 Oct 2008 00:36:42 +0000 Subject: rubygen/framing.0-10/constants.rb: create functions for all 3 exception subclasses. client: added session suspend/resume functions, resume not implemented yet. ClientSessionTest: enabled compilation of suspend/resume tests with expected failures. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@702674 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/SessionImpl.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'cpp/src/qpid/client/SessionImpl.cpp') diff --git a/cpp/src/qpid/client/SessionImpl.cpp b/cpp/src/qpid/client/SessionImpl.cpp index 3e1ea8b724..5c61248b5a 100644 --- a/cpp/src/qpid/client/SessionImpl.cpp +++ b/cpp/src/qpid/client/SessionImpl.cpp @@ -105,7 +105,7 @@ void SessionImpl::open(uint32_t timeout) // user thread waitFor(ATTACHED); //TODO: timeout will not be set locally until get response to //confirm, should we wait for that? - proxy.requestTimeout(timeout); + setTimeout(timeout); proxy.commandPoint(nextOut, 0); } else { throw Exception("Open already called for this session"); @@ -115,11 +115,7 @@ void SessionImpl::open(uint32_t timeout) // user thread void SessionImpl::close() //user thread { Lock l(state); - if (detachedLifetime) { - proxy.requestTimeout(0); - //should we wait for the timeout response? - detachedLifetime = 0; - } + if (detachedLifetime) setTimeout(0); detach(); waitFor(DETACHED); } @@ -613,11 +609,8 @@ void SessionImpl::exception(uint16_t errorCode, error = EXCEPTION; code = errorCode; text = description; - if (detachedLifetime) { - proxy.requestTimeout(0); - //should we wait for the timeout response? - detachedLifetime = 0; - } + if (detachedLifetime) + setTimeout(0); } @@ -639,10 +632,10 @@ inline void SessionImpl::waitFor(State s) //call with lock held void SessionImpl::check() const //call with lock held. { switch (error) { - case OK: break; - case CONNECTION_CLOSE: throw ConnectionException(code, text); - case SESSION_DETACH: throw ChannelException(code, text); - case EXCEPTION: throwExecutionException(code, text); + case OK: break; + case CONNECTION_CLOSE: throw ConnectionException(code, text); + case SESSION_DETACH: throw ChannelException(code, text); + case EXCEPTION: createSessionException(code, text).raise(); } } @@ -668,4 +661,11 @@ void SessionImpl::handleClosed() results.close(); } +uint32_t SessionImpl::setTimeout(uint32_t seconds) { + proxy.requestTimeout(seconds); + // FIXME aconway 2008-10-07: wait for timeout response from broker + // and use value retured by broker. + detachedLifetime = seconds; + return detachedLifetime; +} }} -- cgit v1.2.1