Reinstate Uploaded and Downloaded values in tracker announces

Fixes followup comment in #71.
This commit is contained in:
Matt Joiner 2018-04-12 16:12:14 +10:00
parent 485d8cdf61
commit ed75065f76
1 changed files with 9 additions and 1 deletions

View File

@ -1325,14 +1325,22 @@ func (t *Torrent) startMissingTrackerScrapers() {
// Returns an AnnounceRequest with fields filled out to defaults and current // Returns an AnnounceRequest with fields filled out to defaults and current
// values. // values.
func (t *Torrent) announceRequest() tracker.AnnounceRequest { func (t *Torrent) announceRequest() tracker.AnnounceRequest {
// Note that IPAddress is not set. It's set for UDP inside the tracker
// code, since it's dependent on the network in use.
return tracker.AnnounceRequest{ return tracker.AnnounceRequest{
Event: tracker.None, Event: tracker.None,
NumWant: -1, NumWant: -1,
Port: uint16(t.cl.incomingPeerPort()), Port: uint16(t.cl.incomingPeerPort()),
PeerId: t.cl.peerID, PeerId: t.cl.peerID,
InfoHash: t.infoHash, InfoHash: t.infoHash,
Left: t.bytesLeftAnnounce(),
Key: t.cl.announceKey(), Key: t.cl.announceKey(),
// The following are vaguely described in BEP 3.
Left: t.bytesLeftAnnounce(),
Uploaded: t.stats.BytesWrittenData,
// There's no mention of wasted or unwanted download in the BEP.
Downloaded: t.stats.BytesReadUsefulData,
} }
} }