Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 82274CC8F for ; Fri, 28 Jun 2013 12:23:40 +0000 (UTC) Received: (qmail 90567 invoked by uid 500); 28 Jun 2013 12:23:40 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 90544 invoked by uid 500); 28 Jun 2013 12:23:39 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 90536 invoked by uid 99); 28 Jun 2013 12:23:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jun 2013 12:23:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jun 2013 12:23:36 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 47BEF23889EC; Fri, 28 Jun 2013 12:23:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1497749 - in /qpid/trunk/qpid/cpp/src/qpid/messaging/amqp: ConnectionContext.cpp ConnectionContext.h Date: Fri, 28 Jun 2013 12:23:16 -0000 To: commits@qpid.apache.org From: gsim@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130628122316.47BEF23889EC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gsim Date: Fri Jun 28 12:23:15 2013 New Revision: 1497749 URL: http://svn.apache.org/r1497749 Log: QPID-4966: ensure timeout is honoured while waiting of rmessages Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp?rev=1497749&r1=1497748&r2=1497749&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp Fri Jun 28 12:23:15 2013 @@ -270,7 +270,7 @@ bool ConnectionContext::get(boost::share pn_link_advance(lnk->receiver); return true; } else if (until > qpid::sys::now()) { - wait(ssn, lnk); + waitUntil(ssn, lnk, until); } else { return false; } @@ -427,9 +427,8 @@ pn_state_t REQUIRES_CLOSE = PN_LOCAL_ACT pn_state_t IS_CLOSED = PN_LOCAL_CLOSED | PN_REMOTE_CLOSED; } -void ConnectionContext::wait() +void ConnectionContext::check() { - lock.wait(); if (state == DISCONNECTED) { throw qpid::messaging::TransportFailure("Disconnected"); } @@ -438,6 +437,17 @@ void ConnectionContext::wait() throw qpid::messaging::ConnectionError("Connection closed by peer"); } } + +void ConnectionContext::wait() +{ + lock.wait(); + check(); +} +void ConnectionContext::waitUntil(qpid::sys::AbsTime until) +{ + lock.wait(until); + check(); +} void ConnectionContext::wait(boost::shared_ptr ssn) { wait(); @@ -453,6 +463,21 @@ void ConnectionContext::wait(boost::shar wait(); checkClosed(ssn, lnk); } +void ConnectionContext::waitUntil(boost::shared_ptr ssn, qpid::sys::AbsTime until) +{ + waitUntil(until); + checkClosed(ssn); +} +void ConnectionContext::waitUntil(boost::shared_ptr ssn, boost::shared_ptr lnk, qpid::sys::AbsTime until) +{ + waitUntil(until); + checkClosed(ssn, lnk); +} +void ConnectionContext::waitUntil(boost::shared_ptr ssn, boost::shared_ptr lnk, qpid::sys::AbsTime until) +{ + waitUntil(until); + checkClosed(ssn, lnk); +} void ConnectionContext::checkClosed(boost::shared_ptr ssn) { if ((pn_session_state(ssn->session) & REQUIRES_CLOSE) == REQUIRES_CLOSE) { Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h?rev=1497749&r1=1497748&r2=1497749&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h (original) +++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h Fri Jun 28 12:23:15 2013 @@ -135,10 +135,15 @@ class ConnectionContext : public qpid::s }; CodecSwitch codecSwitch; + void check(); void wait(); + void waitUntil(qpid::sys::AbsTime until); void wait(boost::shared_ptr); + void waitUntil(boost::shared_ptr, qpid::sys::AbsTime until); void wait(boost::shared_ptr, boost::shared_ptr); void wait(boost::shared_ptr, boost::shared_ptr); + void waitUntil(boost::shared_ptr, boost::shared_ptr, qpid::sys::AbsTime until); + void waitUntil(boost::shared_ptr, boost::shared_ptr, qpid::sys::AbsTime until); void checkClosed(boost::shared_ptr); void checkClosed(boost::shared_ptr, boost::shared_ptr); void checkClosed(boost::shared_ptr, boost::shared_ptr); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org