if r == "disconnected":
self.peers.append(None)
else:
- self.peers.append(FakePeer(peerid, r))
+ self.peers.append(FakePeer(str(peerid), r))
def permute_peerids(self, key, max_peers):
assert max_peers == None
- return range(len(self.peers))
+ return [str(i) for i in range(len(self.peers))]
+
def get_remote_service(self, peerid, name):
- peer = self.peers[peerid]
+ peer = self.peers[int(peerid)]
if not peer:
return defer.fail(IndexError("no connection to that peer"))
return defer.succeed(peer)
]
def compare_landlords(self, u, c, expected):
- exp = [(peerid, bucketnum, c.peers[peerid])
+ exp = [(str(peerid), bucketnum, c.peers[peerid])
for peerid, bucketnum in expected]
self.failUnlessEqual(u.landlords, exp)
def start(self):
+ if self.debug:
+ print "starting upload"
# first step: who should we upload to?
# maybe limit max_peers to 2*len(self.shares), to reduce memory
max_peers = None
self.permuted = self._peer.permute_peerids(self._verifierid, max_peers)
+ for p in self.permuted:
+ assert isinstance(p, str)
# we will shrink self.permuted as we give up on peers
self.peer_index = 0
self.goodness_points = 0