You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2016/08/31 16:51:58 UTC

qpid-dispatch git commit: DISPATCH-491 - Drive the HELLO protocol off one-second ticks, not real time. This prevents random instances of two-second intervals between HELLOs.

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 39afec9c1 -> 19e85bce1


DISPATCH-491 - Drive the HELLO protocol off one-second ticks, not real time.  This prevents random instances of two-second intervals between HELLOs.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/19e85bce
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/19e85bce
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/19e85bce

Branch: refs/heads/master
Commit: 19e85bce187b43baab833f266902df4f38af8947
Parents: 39afec9
Author: Ted Ross <tr...@redhat.com>
Authored: Wed Aug 31 12:50:22 2016 -0400
Committer: Ted Ross <tr...@redhat.com>
Committed: Wed Aug 31 12:50:22 2016 -0400

----------------------------------------------------------------------
 python/qpid_dispatch_internal/router/hello.py | 22 ++++++++++++----------
 tests/router_engine_test.py                   |  4 +---
 2 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/19e85bce/python/qpid_dispatch_internal/router/hello.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/router/hello.py b/python/qpid_dispatch_internal/router/hello.py
index 0b214a9..8c3224a 100644
--- a/python/qpid_dispatch_internal/router/hello.py
+++ b/python/qpid_dispatch_internal/router/hello.py
@@ -25,20 +25,22 @@ class HelloProtocol(object):
     This module is responsible for running the HELLO protocol.
     """
     def __init__(self, container, node_tracker):
-        self.container       = container
-        self.node_tracker    = node_tracker
-        self.id              = self.container.id
-        self.last_hello_time = 0.0
-        self.hello_interval  = container.config.helloInterval
-        self.hello_max_age   = container.config.helloMaxAge
-        self.hellos          = {}
-        self.dup_reported    = False
+        self.container        = container
+        self.node_tracker     = node_tracker
+        self.id               = self.container.id
+        self.ticks            = 0.0
+        self.last_hello_ticks = 0.0
+        self.hello_interval   = container.config.helloInterval
+        self.hello_max_age    = container.config.helloMaxAge
+        self.hellos           = {}
+        self.dup_reported     = False
 
 
     def tick(self, now):
         self._expire_hellos(now)
-        if now - self.last_hello_time >= self.hello_interval:
-            self.last_hello_time = now
+        self.ticks += 1.0
+        if self.ticks - self.last_hello_ticks >= self.hello_interval:
+            self.last_hello_ticks = self.ticks
             msg = MessageHELLO(None, self.id, self.hellos.keys(), self.container.instance)
             self.container.send('amqp:/_local/qdhello', msg)
             self.container.log_hello(LOG_TRACE, "SENT: %r" % msg)

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/19e85bce/tests/router_engine_test.py
----------------------------------------------------------------------
diff --git a/tests/router_engine_test.py b/tests/router_engine_test.py
index 2294ffb..8a18baa 100644
--- a/tests/router_engine_test.py
+++ b/tests/router_engine_test.py
@@ -162,9 +162,7 @@ class NeighborTest(unittest.TestCase):
         self.sent = []
         self.local_link_state = None
         self.engine = HelloProtocol(self, self)
-        self.engine.tick(0.5)
-        self.assertEqual(self.sent, [])
-        self.engine.tick(1.5)
+        self.engine.tick(1.0)
         self.assertEqual(len(self.sent), 1)
         dest, msg = self.sent.pop(0)
         self.assertEqual(dest, "amqp:/_local/qdhello")


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