mutable: cosmetic changes

This commit is contained in:
Brian Warner 2008-03-10 15:44:05 -07:00
parent d6cde55c63
commit 9e460cd22e
2 changed files with 22 additions and 21 deletions

View File

@ -514,10 +514,11 @@ class Retrieve:
def _got_results_one_share(self, shnum, data, peerid):
self.log("_got_results: got shnum #%d from peerid %s"
% (shnum, idlib.shortnodeid_b2a(peerid)))
# this might raise NeedMoreDataError, in which case the rest of
# the shares are probably short too. _query_failed() will take
# responsiblity for re-issuing the queries with a new length.
(seqnum, root_hash, IV, k, N, segsize, datalength,
# this might raise NeedMoreDataError, in which case the rest of
# the shares are probably short too. _query_failed() will take
# responsiblity for re-issuing the queries with a new length.
pubkey_s, signature, prefix) = unpack_prefix_and_signature(data)
if not self._pubkey:
@ -1088,7 +1089,7 @@ class Publish:
d.addCallback(self._got_all_query_results,
total_shares, reachable_peers,
current_share_peers)
# TODO: add an errback to, probably to ignore that peer
# TODO: add an errback too, probably to ignore that peer
# TODO: if we can't get a privkey from these servers, consider
# looking farther afield. Be aware of the old 0.7.0 behavior that

View File

@ -141,6 +141,23 @@ class FakeClient:
d.addCallback(_got_data)
return d
class FakePubKey:
def __init__(self, count):
self.count = count
def serialize(self):
return "PUBKEY-%d" % self.count
def verify(self, msg, signature):
return True
class FakePrivKey:
def __init__(self, count):
self.count = count
def serialize(self):
return "PRIVKEY-%d" % self.count
def sign(self, data):
return "SIGN(%s)" % data
class Filenode(unittest.TestCase):
def setUp(self):
self.client = FakeClient()
@ -396,20 +413,3 @@ class Publish(unittest.TestCase):
pass
d.addCallback(_done)
return d
class FakePubKey:
def __init__(self, count):
self.count = count
def serialize(self):
return "PUBKEY-%d" % self.count
def verify(self, msg, signature):
return True
class FakePrivKey:
def __init__(self, count):
self.count = count
def serialize(self):
return "PRIVKEY-%d" % self.count
def sign(self, data):
return "SIGN(%s)" % data