Set tracker announce numWant to 0 if we're unable to dial
This commit is contained in:
parent
74986db9ed
commit
eec337d4bc
14
torrent.go
14
torrent.go
@ -1379,11 +1379,17 @@ func (t *Torrent) startMissingTrackerScrapers() {
|
||||
// Returns an AnnounceRequest with fields filled out to defaults and current
|
||||
// values.
|
||||
func (t *Torrent) announceRequest(event tracker.AnnounceEvent) 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.
|
||||
// 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{
|
||||
Event: event,
|
||||
NumWant: -1,
|
||||
Event: event,
|
||||
NumWant: func() int32 {
|
||||
if t.wantPeers() && len(t.cl.dialers) > 0 {
|
||||
return -1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}(),
|
||||
Port: uint16(t.cl.incomingPeerPort()),
|
||||
PeerId: t.cl.peerID,
|
||||
InfoHash: t.infoHash,
|
||||
|
@ -116,7 +116,7 @@ func (me *trackerScraper) announce(event tracker.AnnounceEvent) (ret trackerAnno
|
||||
me.t.cl.rLock()
|
||||
req := me.t.announceRequest(event)
|
||||
me.t.cl.rUnlock()
|
||||
//log.Printf("announcing %s %s to %q", me.t, req.Event, me.u.String())
|
||||
me.t.logger.Printf("announcing to %q: %#v", me.u.String(), req)
|
||||
res, err := tracker.Announce{
|
||||
HTTPProxy: me.t.cl.config.HTTPProxy,
|
||||
UserAgent: me.t.cl.config.HTTPUserAgent,
|
||||
|
Loading…
x
Reference in New Issue
Block a user