diff options
| author | Gordon Sim <gsim@apache.org> | 2013-11-01 16:55:59 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2013-11-01 16:55:59 +0000 |
| commit | ea04b5b526af50054159fe5c7194907c6e7f1032 (patch) | |
| tree | 764a0304fb81e267a4f5b0fc3d04fb2957a08310 /qpid/cpp | |
| parent | 245ae6f79cc3c818603f9952290cc9f33700615a (diff) | |
| download | qpid-python-ea04b5b526af50054159fe5c7194907c6e7f1032.tar.gz | |
QPID-5286: replenish credit when using get
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1537985 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
| -rw-r--r-- | qpid/cpp/src/qpid/messaging/Receiver.cpp | 6 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/qpid/cpp/src/qpid/messaging/Receiver.cpp b/qpid/cpp/src/qpid/messaging/Receiver.cpp index 18670ec068..a2c6b4cade 100644 --- a/qpid/cpp/src/qpid/messaging/Receiver.cpp +++ b/qpid/cpp/src/qpid/messaging/Receiver.cpp @@ -38,7 +38,11 @@ Receiver::Receiver(ReceiverImpl* impl) { PI::ctor(*this, impl); } Receiver::Receiver(const Receiver& s) : Handle<ReceiverImpl>() { PI::copy(*this, s); } Receiver::~Receiver() { PI::dtor(*this); } Receiver& Receiver::operator=(const Receiver& s) { return PI::assign(*this, s); } -bool Receiver::get(Message& message, Duration timeout) { return impl->get(message, timeout); } +bool Receiver::get(Message& message, Duration timeout) +{ + MessageImplAccess::get(message).clear(); + return impl->get(message, timeout); +} Message Receiver::get(Duration timeout) { return impl->get(timeout); } bool Receiver::fetch(Message& message, Duration timeout) { diff --git a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index b230aeaf0d..f390ee3f0e 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -149,11 +149,6 @@ bool ConnectionContext::fetch(boost::shared_ptr<SessionContext> ssn, boost::shar } } if (get(ssn, lnk, message, timeout)) { - qpid::sys::ScopedLock<qpid::sys::Monitor> l(lock); - if (lnk->capacity) { - pn_link_flow(lnk->receiver, 1);//TODO: is this the right approach? - wakeupDriver(); - } return true; } else { { @@ -212,6 +207,10 @@ bool ConnectionContext::get(boost::shared_ptr<SessionContext> ssn, boost::shared impl.setEncoded(encoded); impl.setInternalId(ssn->record(current)); pn_link_advance(lnk->receiver); + if (lnk->capacity) { + pn_link_flow(lnk->receiver, 1); + wakeupDriver();//TODO: wakeup less frequently + } return true; } else if (until > qpid::sys::now()) { waitUntil(ssn, lnk, until); |
