fetcher.py: improve comments
This commit is contained in:
parent
2a05aa2d91
commit
fa34e4dd16
|
@ -161,13 +161,17 @@ class SegmentFetcher:
|
||||||
# that will trigger the ShareFinder to keep looking
|
# that will trigger the ShareFinder to keep looking
|
||||||
|
|
||||||
def _find_one(self, shares, state):
|
def _find_one(self, shares, state):
|
||||||
# TODO could choose fastest
|
# TODO could choose fastest, or avoid servers already in use
|
||||||
for s in shares:
|
for s in shares:
|
||||||
if self._shares[s] == state:
|
if self._shares[s] == state:
|
||||||
return s
|
return s
|
||||||
# can never get here, caller has assert in case of code bug
|
# can never get here, caller has assert in case of code bug
|
||||||
|
|
||||||
def _send_new_request(self):
|
def _send_new_request(self):
|
||||||
|
# TODO: this is probably O(k^2), and we're called from a range(k)
|
||||||
|
# loop, so O(k^3)
|
||||||
|
|
||||||
|
# this first loop prefers sh0, then sh1, sh2, etc
|
||||||
for shnum,shares in sorted(self._shnums.iteritems()):
|
for shnum,shares in sorted(self._shnums.iteritems()):
|
||||||
states = [self._shares[s] for s in shares]
|
states = [self._shares[s] for s in shares]
|
||||||
if COMPLETE in states or PENDING in states:
|
if COMPLETE in states or PENDING in states:
|
||||||
|
|
Loading…
Reference in New Issue