diff options
| author | Gordon Sim <gsim@apache.org> | 2014-01-21 18:27:32 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2014-01-21 18:27:32 +0000 |
| commit | a34b4b253171cc68d1af3b4b3e3119ff093b4d7a (patch) | |
| tree | 70be4f2c035bccb3e884a361b63fb890c65bc885 /qpid/cpp/src | |
| parent | 772082ba2398e903c725c12e40b9e8a63aec790a (diff) | |
| download | qpid-python-a34b4b253171cc68d1af3b4b3e3119ff093b4d7a.tar.gz | |
QPID-5497: implement Session::sync()
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1560125 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 11 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h | 1 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/messaging/amqp/SessionHandle.cpp | 6 |
3 files changed, 16 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index c9cdd075bc..b762ed036c 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -125,6 +125,17 @@ bool ConnectionContext::isOpen() const return state == CONNECTED && pn_connection_state(connection) & (PN_LOCAL_ACTIVE | PN_REMOTE_ACTIVE); } +void ConnectionContext::sync(boost::shared_ptr<SessionContext> ssn) +{ + qpid::sys::ScopedLock<qpid::sys::Monitor> l(lock); + //wait for outstanding sends to settle + while (!ssn->settled()) { + QPID_LOG(debug, "Waiting for sends to settle on sync()"); + wait(ssn);//wait until message has been confirmed + } + checkClosed(ssn); +} + void ConnectionContext::endSession(boost::shared_ptr<SessionContext> ssn) { qpid::sys::ScopedLock<qpid::sys::Monitor> l(lock); diff --git a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h index 94cdefccfc..70ace473f2 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h +++ b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h @@ -84,6 +84,7 @@ class ConnectionContext : public qpid::sys::ConnectionCodec, public qpid::messag bool get(boost::shared_ptr<SessionContext> ssn, boost::shared_ptr<ReceiverContext> lnk, qpid::messaging::Message& message, qpid::messaging::Duration timeout); void acknowledge(boost::shared_ptr<SessionContext> ssn, qpid::messaging::Message* message, bool cumulative); void nack(boost::shared_ptr<SessionContext> ssn, qpid::messaging::Message& message, bool reject); + void sync(boost::shared_ptr<SessionContext> ssn); void setOption(const std::string& name, const qpid::types::Variant& value); std::string getAuthenticatedUsername(); diff --git a/qpid/cpp/src/qpid/messaging/amqp/SessionHandle.cpp b/qpid/cpp/src/qpid/messaging/amqp/SessionHandle.cpp index 044f208564..8334876b84 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/SessionHandle.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/SessionHandle.cpp @@ -75,9 +75,11 @@ void SessionHandle::close() connection->endSession(session); } -void SessionHandle::sync(bool /*block*/) +void SessionHandle::sync(bool block) { - + if (block) { + connection->sync(session); + } } qpid::messaging::Sender SessionHandle::createSender(const qpid::messaging::Address& address) |
