qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kgiu...@apache.org
Subject svn commit: r1696415 - in /qpid/trunk/qpid/cpp/src/qpid: broker/amqp/Connection.cpp messaging/amqp/ConnectionContext.cpp
Date Tue, 18 Aug 2015 13:29:56 GMT
Author: kgiusti
Date: Tue Aug 18 13:29:56 2015
New Revision: 1696415

URL: http://svn.apache.org/r1696415
Log:
QPID-6698: use the monotonic clock for AMQP 1.0 idle timeout

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Connection.cpp
    qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Connection.cpp?rev=1696415&r1=1696414&r2=1696415&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Connection.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Connection.cpp Tue Aug 18 13:29:56 2015
@@ -209,7 +209,9 @@ size_t Connection::decode(const char* bu
             pn_condition_set_description(error, e.what());
             close();
         }
-        pn_transport_tick(transport, qpid::sys::Duration::FromEpoch() / qpid::sys::TIME_MSEC);
+        // QPID-6698: don't use wallclock here, use monotonic clock
+        int64_t now = qpid::sys::Duration(qpid::sys::ZERO, qpid::sys::AbsTime::now());
+        pn_transport_tick(transport, now / int64_t(qpid::sys::TIME_MSEC));
         if (!haveOutput) {
             haveOutput = true;
             out.activateOutput();
@@ -317,7 +319,9 @@ bool Connection::canEncode()
         QPID_LOG(info, "Connection " << id << " has been closed locally");
     }
     if (ioRequested.valueCompareAndSwap(true, false)) haveOutput = true;
-    pn_transport_tick(transport, qpid::sys::Duration::FromEpoch() / qpid::sys::TIME_MSEC);
+    // QPID-6698: don't use wallclock here, use monotonic clock
+    int64_t now = qpid::sys::Duration(qpid::sys::ZERO, qpid::sys::AbsTime::now());
+    pn_transport_tick(transport, (now / int64_t(qpid::sys::TIME_MSEC)));
     QPID_LOG_CAT(trace, network, id << " canEncode(): " << haveOutput)
     return haveOutput;
 }

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=1696415&r1=1696414&r2=1696415&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp Tue Aug 18 13:29:56
2015
@@ -821,7 +821,9 @@ std::size_t ConnectionContext::decodePla
             }
         }
         QPID_LOG_CAT(debug, network, id << " decoded " << n << " bytes
from " << size)
-        pn_transport_tick(engine, qpid::sys::Duration::FromEpoch() / qpid::sys::TIME_MSEC);
+        // QPID-6698: don't use wallclock here, use monotonic clock
+        int64_t now = qpid::sys::Duration(qpid::sys::ZERO, qpid::sys::AbsTime::now());
+        pn_transport_tick(engine, now / int64_t(qpid::sys::TIME_MSEC));
         lock.notifyAll();
         return n;
     } else if (n == PN_ERR) {
@@ -877,7 +879,10 @@ std::size_t ConnectionContext::encodePla
 bool ConnectionContext::canEncodePlain()
 {
     sys::Monitor::ScopedLock l(lock);
-    pn_transport_tick(engine, qpid::sys::Duration::FromEpoch() / qpid::sys::TIME_MSEC);
+
+    // QPID-6698: don't use wallclock here, use monotonic clock
+    int64_t now = qpid::sys::Duration(qpid::sys::ZERO, qpid::sys::AbsTime::now());
+    pn_transport_tick(engine, now / int64_t(qpid::sys::TIME_MSEC));
     return (haveOutput || pn_transport_pending(engine)) && state == CONNECTED;
 }
 void ConnectionContext::closed()



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message