fixed issue with server saving empty node list when caching to disk for first run

This commit is contained in:
Brian Muller 2014-12-26 20:57:43 +01:00
parent 4b8eaf7c5f
commit c6f1062082
2 changed files with 4 additions and 1 deletions

View File

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

View File

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