from itertools import islice
from zope.interface import implements
from twisted.internet import defer
-from twisted.python import failure
+from twisted.python import failure, log
from foolscap.eventual import eventually
from allmydata.interfaces import IMutableFileNode, IMutableFileURI
from allmydata.util import hashutil, mathutil, idlib
#self._node._client.log(msg)
pass
+ def log_err(self, f):
+ log.err(f)
+
def retrieve(self):
"""Retrieve the filenode's current contents. Returns a Deferred that
fires with a string when the contents have been retrieved."""
d.addCallback(self._got_results, peerid, readsize)
d.addErrback(self._query_failed, peerid, (conn, storage_index,
peer_storage_servers))
+ # errors that aren't handled by _query_failed (and errors caused by
+ # _query_failed) get logged, but we still want to check for doneness.
+ d.addErrback(log.err)
+ d.addBoth(self._check_for_done)
return d
def _deserialize_pubkey(self, pubkey_s):
_ignored = unpack_share(data)
self._valid_versions[verinfo][1].add(shnum, (peerid, data))
- self._check_for_done()
-
def _query_failed(self, f, peerid, stuff):
self._queries_outstanding.discard(peerid)
self.log("WEIRD: bad share for %s: %s" % (short_sid, f))
else:
self.log("WEIRD: other error for %s: %s" % (short_sid, f))
- self._check_for_done()
- def _check_for_done(self):
+ def _check_for_done(self, res):
+ if not self._running:
+ return
share_prefixes = {}
versionmap = DictOfSets()
for verinfo, (prefix, sharemap) in self._valid_versions.items():