test: test-mesh - Correctly stop periodic publication
authorInga Stotland <inga.stotland@intel.com>
Sun, 30 Jun 2019 06:43:56 +0000 (23:43 -0700)
committerAnupam Roy <anupam.r@samsung.com>
Tue, 17 Dec 2019 15:20:08 +0000 (20:50 +0530)
This changes the order of checks for an updated publication period:
check for zero period first, and if this is the case, stop sending
the periodic model publications.

Change-Id: I2693c5a593fa23e59dd2e015348f1fd96a30c88f
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
test/test-mesh

index c075a64..4d515e1 100755 (executable)
@@ -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):