From 7c6899e49fd733e983c563bc05d5d054d32b4f3f Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Sun, 28 Jul 2013 22:33:14 -0500 Subject: [PATCH] Clean up debug logging for peer lists Fixed the peer-list printing function so that it signals there is no peer list if we've not yet received one. --- ipsc.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ipsc.py b/ipsc.py index 59f2289..83355d2 100644 --- a/ipsc.py +++ b/ipsc.py @@ -135,10 +135,14 @@ def mode_decode(_network, _mode, _peer): # Gratuituous print-out of the peer list.. Pretty much debug stuff. # -def print_peer_list(_network_name): +def print_peer_list(_network): _log = logger.info - _log('\t Peer List for: %s', _network_name) - for dictionary in NETWORK[_network_name]['PEERS']: + if not NETWORK[_network]['PEERS']: + _log('\tNo peer list yet for: %s', _network) + return + + _log('\tPeer List for: %s', _network) + for dictionary in NETWORK[_network]['PEERS']: _log('\tIP Address: %s:%s', dictionary['IP'], dictionary['PORT']) _log('\tRADIO ID: %s ', int(binascii.b2a_hex(dictionary['RADIO_ID']), 16)) _log('\tIPSC Mode:')