Remove unused trackerTier and shuffleTier
This commit is contained in:
parent
f47fd8c969
commit
5d7882a79d
18
client.go
18
client.go
@ -9,7 +9,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
mathRand "math/rand"
|
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -1381,23 +1380,6 @@ func (cl *Client) newTorrent(ih metainfo.Hash) (t *Torrent) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
|
||||||
// For shuffling the tracker tiers.
|
|
||||||
mathRand.Seed(time.Now().Unix())
|
|
||||||
}
|
|
||||||
|
|
||||||
type trackerTier []string
|
|
||||||
|
|
||||||
// The trackers within each tier must be shuffled before use.
|
|
||||||
// http://stackoverflow.com/a/12267471/149482
|
|
||||||
// http://www.bittorrent.org/beps/bep_0012.html#order-of-processing
|
|
||||||
func shuffleTier(tier trackerTier) {
|
|
||||||
for i := range tier {
|
|
||||||
j := mathRand.Intn(i + 1)
|
|
||||||
tier[i], tier[j] = tier[j], tier[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// A file-like handle to some torrent data resource.
|
// A file-like handle to some torrent data resource.
|
||||||
type Handle interface {
|
type Handle interface {
|
||||||
io.Reader
|
io.Reader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user