From 9e460cd22ec4b8bbefcfb63cd2e52970ddf0702b Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 10 Mar 2008 15:44:05 -0700 Subject: [PATCH] mutable: cosmetic changes --- src/allmydata/mutable.py | 9 ++++---- src/allmydata/test/test_mutable.py | 34 +++++++++++++++--------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/allmydata/mutable.py b/src/allmydata/mutable.py index c57e5d69..e6a47227 100644 --- a/src/allmydata/mutable.py +++ b/src/allmydata/mutable.py @@ -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 diff --git a/src/allmydata/test/test_mutable.py b/src/allmydata/test/test_mutable.py index 18469836..32ef820c 100644 --- a/src/allmydata/test/test_mutable.py +++ b/src/allmydata/test/test_mutable.py @@ -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 -- 2.45.2