Master Support Cleanup

Also fixed lack of decoding of some hex strings in debug logging
function calls.
This commit is contained in:
Cort Buffington 2014-05-15 17:17:54 -05:00
parent 8cbf6c678f
commit 68d52ee976
2 changed files with 29 additions and 15 deletions

View File

@ -134,6 +134,11 @@ try:
'KEEP_ALIVES_MISSED': 0, 'KEEP_ALIVES_MISSED': 0,
'KEEP_ALIVES_OUTSTANDING': 0 'KEEP_ALIVES_OUTSTANDING': 0
}, },
'IP': '',
'PORT': ''
})
if not NETWORK[section]['LOCAL']['MASTER_PEER']:
NETWORK[section]['MASTER'].update({
'IP': config.get(section, 'MASTER_IP'), 'IP': config.get(section, 'MASTER_IP'),
'PORT': config.getint(section, 'MASTER_PORT') 'PORT': config.getint(section, 'MASTER_PORT')
}) })
@ -659,20 +664,20 @@ class IPSC(DatagramProtocol):
logger.debug('(%s) Repeater Wake-Up Packet Received: %s', _network, h(_data)) logger.debug('(%s) Repeater Wake-Up Packet Received: %s', _network, h(_data))
def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data): def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
logger.debug('(%s) Group Voice Packet Received From: %s, IPSC Peer %s, Destination %s', _network, _src_sub, _peerid, _dst_sub) logger.debug('(%s) Group Voice Packet Received From: %s, IPSC Peer %s, Destination %s', _network, h(_src_sub), h(_peerid), h(_dst_sub))
def private_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data): def private_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
logger.debug('(%s) Private Voice Packet Received From: %s, IPSC Peer %s, Destination %s', _network, _src_sub, _peerid, _dst_sub) logger.debug('(%s) Private Voice Packet Received From: %s, IPSC Peer %s, Destination %s', _network, h(_src_sub), h(_peerid), h(_dst_sub))
def group_data(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data): def group_data(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
logger.debug('(%s) Group Data Packet Received From: %s, IPSC Peer %s, Destination %s', _network, _src_sub, _peerid, _dst_sub) logger.debug('(%s) Group Data Packet Received From: %s, IPSC Peer %s, Destination %s', _network, h(_src_sub), h(_peerid), h(_dst_sub))
def private_data(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data): def private_data(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
logger.debug('(%s) Private Data Packet Received From: %s, IPSC Peer %s, Destination %s', _network, _src_sub, _peerid, _dst_sub) logger.debug('(%s) Private Data Packet Received From: %s, IPSC Peer %s, Destination %s', _network, h(_src_sub), h(_peerid), h(_dst_sub))
def unknown_message(self, _network, _packettype, _peerid, _data): def unknown_message(self, _network, _packettype, _peerid, _data):
_packettype = h(_packettype) _packettype = h(_packettype)
logger.error('(%s) Unknown message type encountered\n\tPacket Type: %s\n\tFrom: %s\n\tPacket: %s', _network, _packettype, _peerid, h(_data)) logger.error('(%s) Unknown message type encountered\n\tPacket Type: %s\n\tFrom: %s\n\tPacket: %s', _network, h(_packettype), h(_peerid), h(_data))
#************************************************ #************************************************
@ -747,8 +752,12 @@ class IPSC(DatagramProtocol):
# Reporting/Housekeeping # Reporting/Housekeeping
# #
if not self._local['MASTER_PEER']: if not self._local['MASTER_PEER']:
self._maintenance = task.LoopingCall(self.maintenance_loop) self._peer_maintenance = task.LoopingCall(self.peer_maintenance_loop)
self._maintenance_loop = self._maintenance.start(self._local['ALIVE_TIMER']) self._peer_maintenance_loop = self._peer_maintenance.start(self._local['ALIVE_TIMER'])
#
if self._local['MASTER_PEER']:
self._master_maintenance = task.LoopingCall(self.master_maintenance_loop)
self._master_maintenance_loop = self._master_maintenance.start(self._local['ALIVE_TIMER'])
# #
self._reporting = task.LoopingCall(self.reporting_loop) self._reporting = task.LoopingCall(self.reporting_loop)
self._reporting_loop = self._reporting.start(10) self._reporting_loop = self._reporting.start(10)
@ -763,10 +772,15 @@ class IPSC(DatagramProtocol):
print_master(self._network) print_master(self._network)
print_peer_list(self._network) print_peer_list(self._network)
# Timed loop used for IPSC connection Maintenance if we are a PEER # Timed loop used for IPSC connection Maintenance when we are the MASTER
# #
def maintenance_loop(self): def master_maintenance_loop(self):
logger.debug('(%s) Periodic Connection Maintenance Loop Started', self._network) logger.debug('(%s) MASTER Connection Maintenance Loop Started *NOT YET IMPLEMENTED*', self._network)
# Timed loop used for IPSC connection Maintenance when we are a PEER
#
def peer_maintenance_loop(self):
logger.debug('(%s) PEER Connection Maintenance Loop Started', self._network)
# If the master isn't connected, we have to do that before we can do anything else! # If the master isn't connected, we have to do that before we can do anything else!
# #

View File

@ -72,8 +72,8 @@ LOG_LEVEL: CRITICAL
# MASTER_PEER: Must be False, we cannot yet act as a master peer. # MASTER_PEER: Must be False, we cannot yet act as a master peer.
# AUTH_ENABLED: Do we use authenticated IPSC? # AUTH_ENABLED: Do we use authenticated IPSC?
# AUTH_KEY: The Authentication key (up to 40 hex characters) # AUTH_KEY: The Authentication key (up to 40 hex characters)
# MASTER_IP: IP address of the IPSC master # MASTER_IP: IP address of the IPSC master (ignored if DMRlink is the master)
# MASTER_PORT: UDP port of the IPSC master # MASTER_PORT: UDP port of the IPSC master (ignored if DMRlinkn is the master)
# #
# ...Repeat the block for each IPSC network to join. # ...Repeat the block for each IPSC network to join.
# #