From fbe44e468b1f465283ecb382b59e3217370cc9b4 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Wed, 5 Dec 2018 08:59:52 -0600 Subject: [PATCH] Added connection time --- hb_config.py | 1 + hblink.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/hb_config.py b/hb_config.py index c3e3ef6..f8bc619 100755 --- a/hb_config.py +++ b/hb_config.py @@ -188,6 +188,7 @@ def build_config(_config_file): }}) CONFIG['SYSTEMS'][section].update({'STATS': { 'CONNECTION': 'NO', # NO, RTPL_SENT, AUTHENTICATED, CONFIG-SENT, YES + 'CONNECTED': None, 'PINGS_SENT': 0, 'PINGS_ACKD': 0, 'NUM_OUTSTANDING': 0, diff --git a/hblink.py b/hblink.py index fdd422a..3f8bea4 100755 --- a/hblink.py +++ b/hblink.py @@ -391,6 +391,7 @@ class HBSYSTEM(DatagramProtocol): # Build the configuration data strcuture for the peer self._peers.update({_peer_id: { 'CONNECTION': 'RPTL-RECEIVED', + 'CONNECTED': None, 'PINGS_RECEIVED': 0, 'LAST_PING': time(), 'SOCKADDR': _sockaddr, @@ -464,6 +465,7 @@ class HBSYSTEM(DatagramProtocol): and self._peers[_peer_id]['SOCKADDR'] == _sockaddr: _this_peer = self._peers[_peer_id] _this_peer['CONNECTION'] = 'YES' + _this_peer['CONNECTED'] = time() _this_peer['LAST_PING'] = time() _this_peer['CALLSIGN'] = _data[8:16] _this_peer['RX_FREQ'] = _data[16:25] @@ -628,6 +630,7 @@ class HBSYSTEM(DatagramProtocol): logger.info('(%s) Sent options: (%s)', self._system, self._config['OPTIONS']) else: self._stats['CONNECTION'] = 'YES' + self._stats['CONNECTED'] = time() logger.info('(%s) Connection to Master Completed', self._system) else: self._stats['CONNECTION'] = 'NO' @@ -638,6 +641,7 @@ class HBSYSTEM(DatagramProtocol): if self._config['LOOSE'] or _peer_id == self._config['RADIO_ID']: # Validate the Radio_ID unless using loose validation logger.info('(%s) Repeater Options Accepted', self._system) self._stats['CONNECTION'] = 'YES' + self._stats['CONNECTED'] = time() logger.info('(%s) Connection to Master Completed with options', self._system) else: self._stats['CONNECTION'] = 'NO'