Catch all exceptions in options code

This commit is contained in:
Simon 2021-04-29 16:28:57 +01:00
parent 634bcb95d6
commit f2c10e0b8a
2 changed files with 183 additions and 179 deletions

View File

@ -588,6 +588,7 @@ def ident():
def options_config():
logger.debug('(OPTIONS) Running options parser')
for _system in CONFIG['SYSTEMS']:
try:
if CONFIG['SYSTEMS'][_system]['MODE'] != 'MASTER':
continue
if CONFIG['SYSTEMS'][_system]['ENABLED'] == True:
@ -766,6 +767,9 @@ def options_config():
CONFIG['SYSTEMS'][_system]['TS2_STATIC'] = _options['TS2_STATIC']
CONFIG['SYSTEMS'][_system]['DEFAULT_REFLECTOR'] = int(_options['DEFAULT_REFLECTOR'])
CONFIG['SYSTEMS'][_system]['DEFAULT_UA_TIMER'] = int(_options['DEFAULT_UA_TIMER'])
except:
logger.exception('(OPTIONS) caught exception')
continue
def mysqlGetConfig():
logger.debug('(MYSQL) Periodic config check')
@ -1794,7 +1798,7 @@ class routerHBP(HBSYSTEM):
for _sysslot in systems[system].STATUS:
if 'RX_STREAM_ID' in systems[system].STATUS[_sysslot] and _stream_id == systems[system].STATUS[_sysslot]['RX_STREAM_ID']:
if 'LOOPLOG' not in self.STATUS[_slot] or not self.STATUS[_slot]['LOOPLOG']:
logger.warning("(%s) OBP *LoopControl* FIRST HBP: %s, STREAM ID: %s, TG: %s, TS: %s, IGNORE THIS SOURCE",self._system, system, int_id(_stream_id), int_id(_dst_id),_sysslot)
logger.info("(%s) OBP *LoopControl* FIRST HBP: %s, STREAM ID: %s, TG: %s, TS: %s, IGNORE THIS SOURCE",self._system, system, int_id(_stream_id), int_id(_dst_id),_sysslot)
self.STATUS[_slot]['LOOPLOG'] = True
self.STATUS[_slot]['LAST'] = pkt_time
return
@ -1802,7 +1806,7 @@ class routerHBP(HBSYSTEM):
#if _stream_id in systems[system].STATUS and systems[system].STATUS[_stream_id]['START'] <= self.STATUS[_stream_id]['START']:
if _stream_id in systems[system].STATUS and '1ST' in systems[system].STATUS[_stream_id] and systems[system].STATUS[_stream_id]['TGID'] == _dst_id:
if 'LOOPLOG' not in self.STATUS[_slot] or not self.STATUS[_slot]['LOOPLOG']:
logger.warning("(%s) OBP *LoopControl* FIRST OBP %s, STREAM ID: %s, TG %s, IGNORE THIS SOURCE",self._system, system, int_id(_stream_id), int_id(_dst_id))
logger.info("(%s) OBP *LoopControl* FIRST OBP %s, STREAM ID: %s, TG %s, IGNORE THIS SOURCE",self._system, system, int_id(_stream_id), int_id(_dst_id))
self.STATUS[_slot]['LOOPLOG'] = True
self.STATUS[_slot]['LAST'] = pkt_time

View File

@ -150,7 +150,7 @@ class OPENBRIDGE(DatagramProtocol):
_packet = b''.join([BCSQ, _tgid, _stream_id])
_packet = b''.join([_packet, (hmac_new(self._config['PASSPHRASE'],_packet,sha1).digest())])
self.transport.write(_packet, (self._config['TARGET_IP'], self._config['TARGET_PORT']))
logger.info('(%s) *BridgeControl* sent BCSQ Source Quench, TG: %s, Stream ID: %s',self._system,int_id(_tgid), int_id(_stream_id))
logger.debug('(%s) *BridgeControl* sent BCSQ Source Quench, TG: %s, Stream ID: %s',self._system,int_id(_tgid), int_id(_stream_id))
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
@ -236,7 +236,7 @@ class OPENBRIDGE(DatagramProtocol):
self._config['_bcka'] = time()
if _sockaddr != self._config['TARGET_SOCK']:
h,p = _sockaddr
logger.info('(%s) *BridgeControl* Source IP and Port has changed for OBP from %s:%s to %s:%s, updating',self._system,self._config['TARGET_IP'],self._config['TARGET_PORT'],h,p)
logger.warning('(%s) *BridgeControl* Source IP and Port has changed for OBP from %s:%s to %s:%s, updating',self._system,self._config['TARGET_IP'],self._config['TARGET_PORT'],h,p)
self._config['TARGET_IP'] = h
self._config['TARGET_PORT'] = p
self._config['TARGET_SOCK'] = (h,p)
@ -252,7 +252,7 @@ class OPENBRIDGE(DatagramProtocol):
_stream_id = _packet[7:11]
_ckhs = hmac_new(self._config['PASSPHRASE'],_packet[:11],sha1).digest()
if compare_digest(_hash, _ckhs):
logger.info('(%s) *BridgeControl* BCSQ Source Quench request received for TGID: %s, Stream ID: %s',self._system,int_id(_tgid), int_id(_stream_id))
logger.debug('(%s) *BridgeControl* BCSQ Source Quench request received for TGID: %s, Stream ID: %s',self._system,int_id(_tgid), int_id(_stream_id))
if '_bcsq' not in self._config:
self._config['_bcsq'] = {}
self._config['_bcsq'][_tgid] = _stream_id