mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 21:17:54 +00:00
remove get_serverid from DownloadStatus.add_block_request and customers
This is a rebase of a patch Brian originally wrote. I haven't changed the intent of that patch, just ported it to trunk. refs #1363
This commit is contained in:
parent
feca907499
commit
dc66875479
@ -734,8 +734,7 @@ class Share:
|
||||
share=repr(self),
|
||||
start=start, length=length,
|
||||
level=log.NOISY, parent=self._lp, umid="sgVAyA")
|
||||
block_ev = ds.add_block_request(self._server.get_serverid(),
|
||||
self._shnum,
|
||||
block_ev = ds.add_block_request(self._server, self._shnum,
|
||||
start, length, now())
|
||||
d = self._send_request(start, length)
|
||||
d.addCallback(self._got_data, start, length, block_ev, lp)
|
||||
|
@ -116,7 +116,7 @@ class DownloadStatus:
|
||||
|
||||
# self.block_requests tracks share-data requests and responses. It is
|
||||
# a list of dicts:
|
||||
# serverid (binary),
|
||||
# server (instance of IServer)
|
||||
# shnum,
|
||||
# start,length, (of data requested)
|
||||
# start_time
|
||||
@ -168,8 +168,8 @@ class DownloadStatus:
|
||||
self.dyhb_requests.append(r)
|
||||
return DYHBEvent(r, self)
|
||||
|
||||
def add_block_request(self, serverid, shnum, start, length, when):
|
||||
r = { "serverid": serverid,
|
||||
def add_block_request(self, server, shnum, start, length, when):
|
||||
r = { "server": server,
|
||||
"shnum": shnum,
|
||||
"start": start,
|
||||
"length": length,
|
||||
|
@ -409,7 +409,7 @@ class DownloadStatusPage(DownloadResultsRendererMixin, rend.Page):
|
||||
for ev in events:
|
||||
# DownloadStatus promises to give us events in temporal order
|
||||
ev = ev.copy()
|
||||
ev["serverid"] = base32.b2a(ev["serverid"])
|
||||
ev["serverid"] = base32.b2a(ev["server"].get_serverid())
|
||||
if ev["serverid"] not in serverid_to_group:
|
||||
groupnum = len(serverid_to_group)
|
||||
serverid_to_group[ev["serverid"]] = groupnum
|
||||
@ -579,12 +579,13 @@ class DownloadStatusPage(DownloadResultsRendererMixin, rend.Page):
|
||||
T.th["txtime"], T.th["rxtime"],
|
||||
T.th["received"], T.th["RTT"]]]
|
||||
for r_ev in self.download_status.block_requests:
|
||||
server = r_ev["server"]
|
||||
rtt = None
|
||||
if r_ev["finish_time"] is not None:
|
||||
rtt = r_ev["finish_time"] - r_ev["start_time"]
|
||||
serverid_s = idlib.shortnodeid_b2a(r_ev["serverid"])
|
||||
t[T.tr(style="background: %s" % self.color(r_ev["serverid"]))[
|
||||
T.td[serverid_s], T.td[r_ev["shnum"]],
|
||||
color = self.color(server.get_serverid())
|
||||
t[T.tr(style="background: %s" % color)[
|
||||
T.td[server.get_name()], T.td[r_ev["shnum"]],
|
||||
T.td["[%d:+%d]" % (r_ev["start"], r_ev["length"])],
|
||||
T.td[srt(r_ev["start_time"])], T.td[srt(r_ev["finish_time"])],
|
||||
T.td[r_ev["response_length"] or ""],
|
||||
|
Loading…
Reference in New Issue
Block a user