From 9d379bf3c4b7b11967b8eb4404111601546b64d1 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Fri, 24 Mar 2017 08:44:00 -0500 Subject: [PATCH] cancel timers when not in use --- confbridge.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/confbridge.py b/confbridge.py index 5f00fa3..4f3c831 100755 --- a/confbridge.py +++ b/confbridge.py @@ -338,6 +338,10 @@ class confbridgeIPSC(IPSC): if _system['ACTIVE'] == True and _system['TO_TYPE'] == 'ON': _system['TIMER'] = now + _system['TIMEOUT'] self._logger.info('(%s) Bridge: %s, timeout timer reset to: %s', self._system, _bridge, _system['TIMER'] - now) + # Cancel the timer if we've enabled an "OFF" type timeout + if _system['ACTIVE'] == True and _system['TO_TYPE'] == 'OFF': + _system['TIMER'] = now + self._logger.info('(%s) Bridge: %s set to "OFF" with an on timer rule: timeout timer cancelled', self._system, _bridge) # TGID matches an DE-ACTIVATION trigger if _dst_group in _system['OFF']: @@ -349,6 +353,10 @@ class confbridgeIPSC(IPSC): if _system['ACTIVE'] == False and _system['TO_TYPE'] == 'OFF': _system['TIMER'] = now + _system['TIMEOUT'] self._logger.info('(%s) Bridge: %s, timeout timer reset to: %s', self._system, _bridge, _system['TIMER'] - now) + # Cancel the timer if we've enabled an "ON" type timeout + if _system['ACTIVE'] == True and _system['TO_TYPE'] == 'ON': + _system['TIMER'] = now + self._logger.info('(%s) Bridge: %s set to ON with and "OFF" timer rule: timeout timer cancelled', self._system, _bridge) # # END IN-BAND SIGNALLING