client.go | 4 ++-- download.go | 2 +- t.go | 2 +- torrent.go | 6 +++--- diff --git a/client.go b/client.go index 5e542e8e16e7d66ebc3b3ed32b0288fbda7ac200..a64b1f2288c63d860f55598d3da22c2c0a7a35c5 100644 --- a/client.go +++ b/client.go @@ -1831,7 +1831,7 @@ if len(t.HalfOpen) >= me.halfOpenLimit { return } var ( - k peersKey + k PeersKey p Peer ) for k, p = range t.Peers { @@ -1948,7 +1948,7 @@ func newTorrent(ih InfoHash) (t *torrent, err error) { t = &torrent{ InfoHash: ih, chunkSize: defaultChunkSize, - Peers: make(map[peersKey]Peer), + Peers: make(map[PeersKey]Peer), closing: make(chan struct{}), ceasingNetworking: make(chan struct{}), diff --git a/download.go b/download.go index 171da56c7202fc019f1f6bbced5b501bf07d9cba..0a69c6a64f36cd0032c4194243c2e5166c6d7cfc 100644 --- a/download.go +++ b/download.go @@ -23,5 +23,5 @@ AddPeers(pp []Peer) error DownloadAll() Trackers() [][]tracker.Client Files() (ret []File) - Peers() map[peersKey]Peer + Peers() map[PeersKey]Peer } \ No newline at end of file diff --git a/t.go b/t.go index 9d2e7d1bc6777664cd096a4a009c52297e77885d..5f58703eb5eb88d043067f7f74db9b6bad95f4aa 100644 --- a/t.go +++ b/t.go @@ -104,6 +104,6 @@ return t.torrent.Trackers } // Peers returns torrent's peers -func (t Torrent) Peers() map[peersKey]Peer { +func (t Torrent) Peers() map[PeersKey]Peer { return t.torrent.Peers } \ No newline at end of file diff --git a/torrent.go b/torrent.go index 26335e18a51718df6de0c06b35f2f82f5ded3a3c..242dfb8535baf68811f5f49ce94faf434495f209 100644 --- a/torrent.go +++ b/torrent.go @@ -39,7 +39,7 @@ } return } -type peersKey struct { +type PeersKey struct { IPBytes string Port int } @@ -78,7 +78,7 @@ // Reserve of peers to connect to. A peer can be both here and in the // active connections if were told about the peer after connecting with // them. That encourages us to reconnect to peers that are well known. - Peers map[peersKey]Peer + Peers map[PeersKey]Peer wantPeers sync.Cond // BEP 12 Multitracker Metadata Extension. The tracker.Client instances @@ -180,7 +180,7 @@ cl.openNewConns(t) if len(t.Peers) >= torrentPeersHighWater { return } - key := peersKey{string(p.IP), p.Port} + key := PeersKey{string(p.IP), p.Port} if _, ok := t.Peers[key]; ok { return }