1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00

Changed the way we handle an empty lifetime in APDU looking for None instead of 0 to fix a Runtime error when install_task gets a delta of None

This commit is contained in:
Christian Tremblay, ing 2020-10-25 20:32:58 -04:00
parent d91a7e388a
commit 859cb49c9b

View File

@ -102,11 +102,10 @@ class Subscription(OneShotTask, DebugContents):
self.proc_id = proc_id self.proc_id = proc_id
self.obj_id = obj_id self.obj_id = obj_id
self.confirmed = confirmed self.confirmed = confirmed
self.lifetime = lifetime
# if lifetime is non-zero, schedule the subscription to expire # if lifetime is none, consider permanent subscription (0)
if lifetime != 0: self.lifetime = 0 if lifetime is None else lifetime
self.install_task(delta=self.lifetime) self.install_task(delta=self.lifetime)
def cancel_subscription(self): def cancel_subscription(self):
if _debug: Subscription._debug("cancel_subscription") if _debug: Subscription._debug("cancel_subscription")