mirror of https://github.com/bmuller/kademlia.git
fixed issue with server saving empty node list when caching to disk for first run
This commit is contained in:
parent
4b8eaf7c5f
commit
c6f1062082
|
@ -3,5 +3,5 @@ Kademlia is a Python implementation of the Kademlia protocol for U{Twisted <http
|
|||
|
||||
@author: Brian Muller U{bamuller@gmail.com}
|
||||
"""
|
||||
version_info = (0, 2)
|
||||
version_info = (0, 3)
|
||||
version = '.'.join(map(str, version_info))
|
||||
|
|
|
@ -176,6 +176,9 @@ class Server(object):
|
|||
'alpha': self.alpha,
|
||||
'id': self.node.id,
|
||||
'neighbors': self.bootstrappableNeighbors() }
|
||||
if len(data['neighbors']) == 0:
|
||||
self.log.warning("No known neighbors, so not writing to cache.")
|
||||
return
|
||||
with open(fname, 'w') as f:
|
||||
pickle.dump(data, f)
|
||||
|
||||
|
|
Loading…
Reference in New Issue