From 395cf740ee23e7cd4fa4c270d29a980a0e763cb1 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 28 Jul 2015 11:06:41 +0000 Subject: 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 --- qpid/cpp/src/qpid/broker/amqp/Connection.cpp | 1 + qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'qpid/cpp') 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() { -- cgit v1.2.1