logging and whitespace
This commit is contained in:
parent
5937ead17c
commit
c9515f8fb6
3 changed files with 5 additions and 3 deletions
|
@ -182,8 +182,9 @@ class Node(object):
|
|||
def printContacts(self, *args):
|
||||
print '\n\nNODE CONTACTS\n==============='
|
||||
for i in range(len(self._routingTable._buckets)):
|
||||
print "bucket %i" % i
|
||||
for contact in self._routingTable._buckets[i]._contacts:
|
||||
print contact
|
||||
print " %s:%i" % (contact.address, contact.port)
|
||||
print '=================================='
|
||||
|
||||
def getApproximateTotalDHTNodes(self):
|
||||
|
@ -510,6 +511,7 @@ class Node(object):
|
|||
node is returning all of the contacts that it knows of.
|
||||
@rtype: list
|
||||
"""
|
||||
|
||||
# Get the sender's ID (if any)
|
||||
if '_rpcNodeID' in kwargs:
|
||||
rpc_sender_id = kwargs['_rpcNodeID']
|
||||
|
|
|
@ -399,7 +399,7 @@ class KademliaProtocol(protocol.DatagramProtocol):
|
|||
def _msgTimeout(self, messageID):
|
||||
""" Called when an RPC request message times out """
|
||||
# Find the message that timed out
|
||||
if not self._sentMessages.has_key(messageID):
|
||||
if messageID not in self._sentMessages:
|
||||
# This should never be reached
|
||||
log.error("deferred timed out, but is not present in sent messages list!")
|
||||
return
|
||||
|
|
|
@ -84,7 +84,7 @@ class TreeRoutingTable(object):
|
|||
@type failure: twisted.python.failure.Failure
|
||||
"""
|
||||
failure.trap(TimeoutError)
|
||||
print '==replacing contact=='
|
||||
log.warning('==replacing contact==')
|
||||
# Remove the old contact...
|
||||
deadContactID = failure.getErrorMessage()
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue