diff options
author | Gordon Sim <gsim@apache.org> | 2015-07-28 11:06:41 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2015-07-28 11:06:41 +0000 |
commit | 395cf740ee23e7cd4fa4c270d29a980a0e763cb1 (patch) | |
tree | e23fd4d60fc598c4abcf4a2813a738b3c8b51ef6 | |
parent | e25498363eb4b5baf48d23e2fc819c85d04cc552 (diff) | |
download | qpid-python-395cf740ee23e7cd4fa4c270d29a980a0e763cb1.tar.gz |
QPID-6661: address some anomalies with heartbeats on the AMQP 1.0 path
* the ticker driving heartbeats are restarted whenever data is sent out
* the client checks whether there is data pending in determining whether it can encode
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1693067 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/broker/amqp/Connection.cpp | 1 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/broker/amqp/Connection.cpp b/qpid/cpp/src/qpid/broker/amqp/Connection.cpp index be2e335c4d..e4fce784f1 100644 --- a/qpid/cpp/src/qpid/broker/amqp/Connection.cpp +++ b/qpid/cpp/src/qpid/broker/amqp/Connection.cpp @@ -234,6 +234,7 @@ size_t Connection::encode(char* buffer, size_t size) if (n > 0) { QPID_LOG_CAT(debug, network, id << " encoded " << n << " bytes from " << size) haveOutput = true; + if (ticker) ticker->restart(); return n; } else if (n == PN_EOS) { haveOutput = false; diff --git a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index 63081c8be2..c519c05d71 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -852,6 +852,7 @@ std::size_t ConnectionContext::encodePlain(char* buffer, std::size_t size) QPID_LOG_CAT(debug, network, id << " encoded " << n << " bytes from " << size) haveOutput = true; if (notifyOnWrite) lock.notifyAll(); + if (ticker) ticker->restart(); return n; } else if (n == PN_ERR) { std::string error; @@ -877,7 +878,7 @@ bool ConnectionContext::canEncodePlain() { sys::Monitor::ScopedLock l(lock); pn_transport_tick(engine, qpid::sys::Duration::FromEpoch() / qpid::sys::TIME_MSEC); - return haveOutput && state == CONNECTED; + return (haveOutput || pn_transport_pending(engine)) && state == CONNECTED; } void ConnectionContext::closed() { |