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.
This commit is contained in:
Cort Buffington 2013-07-28 22:33:14 -05:00
parent 440f3d61b4
commit 7c6899e49f
1 changed files with 7 additions and 3 deletions

10
ipsc.py
View File

@ -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:')