2019-06-27 22:49:21

by Stotland, Inga

[permalink] [raw]
Subject: [PATCH BlueZ 4/4 v2] test: test-mesh - Correctly stop periodic publication

This changes the order of checks for an updated publication period:
check for zero address first, and if this is the case, stop sending
the periodic model publications.
---
test/test-mesh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/test-mesh b/test/test-mesh
index c075a642b..4d515e186 100755
--- a/test/test-mesh
+++ b/test/test-mesh
@@ -606,15 +606,15 @@ class OnOffServer(Model):

def set_publication(self, period):

- # We do not handle ms in this example
- if period < 1000:
- return
-
self.pub_period = period
if period == 0:
self.timer.cancel()
return

+ # We do not handle ms in this example
+ if period < 1000:
+ return
+
self.timer.start(period/1000, self.publish)

def publish(self):
--
2.21.0