all: cut bloat found in the pike audit
Dead, vestigial, and over-built code with no behavior change (except the
bool-vocabulary trim, a deliberate behavior tightening):
- httpdl: drop the vestigial sort+copy in validSegs (work-stealing was
removed in 270812d, so segments always tile [0,total) ascending now);
validate order in place, which also rejects a scrambled sidecar. Inline
the endOff() accessor to s.end.
- cli: shrink the boolean vocabulary to true/false, which is all that's
accepted. The invented yes/no/1/0/on/off spellings are gone, so e.g.
--enable-dht=yes (or yes in got.conf) is now a usage error.
- download: remove the dead, never-called Stat.Done() method.
- progress: drop speed(), a pure alias of humanSize; call humanSize directly.
- main: replace the jobsHolder mutex box with atomic.Pointer[[]job] for the
forced-exit session save; the capability stays, the lock and type go.
- bt: collapse isAddrInUse's X||X (missinggo.IsAddrInUse is that exact
string match); drop the now-unused missinggo import (tidy -> indirect).
- option: note that prealloc and falloc are identical here.
This commit is contained in:
8
bt/bt.go
8
bt/bt.go
@@ -19,7 +19,6 @@ import (
|
||||
"time"
|
||||
|
||||
alog "github.com/anacrolix/log"
|
||||
missinggo "github.com/anacrolix/missinggo/v2"
|
||||
"github.com/anacrolix/torrent"
|
||||
"github.com/anacrolix/torrent/metainfo"
|
||||
"github.com/hanbok/got/download"
|
||||
@@ -172,10 +171,11 @@ func NewClient(cfg ClientConfig) (*torrent.Client, error) {
|
||||
return cl, nil
|
||||
}
|
||||
|
||||
// isAddrInUse reports whether err is an "address already in use" bind failure,
|
||||
// matching either missinggo's helper or the raw string the library wraps.
|
||||
// isAddrInUse reports whether err is an "address already in use" bind failure.
|
||||
// (anacrolix/missinggo's IsAddrInUse is this exact string match, so we just do
|
||||
// it directly rather than carry the import for it.)
|
||||
func isAddrInUse(err error) bool {
|
||||
return err != nil && (missinggo.IsAddrInUse(err) || strings.Contains(err.Error(), "address already in use"))
|
||||
return err != nil && strings.Contains(err.Error(), "address already in use")
|
||||
}
|
||||
|
||||
// Options are the per-download settings.
|
||||
|
||||
Reference in New Issue
Block a user