fix divide by zero

options
Simon 4 years ago
parent 6005e10f2f
commit 02cef85926
No known key found for this signature in database
GPG Key ID: 6ACF11630B5D8F82

@ -1772,6 +1772,7 @@ class routerOBP(OPENBRIDGE):
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM):
call_duration = pkt_time - self.STATUS[_stream_id]['START']
packet_rate = 0
if call_duration:
packet_rate = self.STATUS[_stream_id]['packets'] / call_duration
logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Duration: %.2f, Packet rate: %.2f/s', \
self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot, call_duration, packet_rate)
@ -2502,6 +2503,7 @@ class routerHBP(HBSYSTEM):
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM) and (self.STATUS[_slot]['RX_TYPE'] != HBPF_SLT_VTERM):
packet_rate = 0
call_duration = pkt_time - self.STATUS[_slot]['RX_START']
if call_duration:
packet_rate = self.STATUS[_slot]['packets'] / call_duration
logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Duration: %.2f, Packet rate: %.2f/s', \
self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot, call_duration,packet_rate)

Loading…
Cancel
Save

Powered by TurnKey Linux.