From be8e44da3cbf9dd94d89bcd395d938f13524e18c Mon Sep 17 00:00:00 2001 From: Gleb Sinyavsky Date: Sun, 27 Dec 2015 15:27:32 +0300 Subject: [PATCH] peersKey is a public type now --- client.go | 4 ++-- download.go | 2 +- t.go | 2 +- torrent.go | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client.go b/client.go index 5e542e8e..a64b1f22 100644 --- a/client.go +++ b/client.go @@ -1831,7 +1831,7 @@ func (me *Client) openNewConns(t *torrent) { 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 171da56c..0a69c6a6 100644 --- a/download.go +++ b/download.go @@ -23,5 +23,5 @@ type Download interface { 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 9d2e7d1b..5f58703e 100644 --- a/t.go +++ b/t.go @@ -104,6 +104,6 @@ func (t Torrent) Trackers() [][]tracker.Client { } // 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 26335e18..242dfb85 100644 --- a/torrent.go +++ b/torrent.go @@ -39,7 +39,7 @@ func (t *torrent) pieceNumPendingBytes(index int) (count pp.Integer) { return } -type peersKey struct { +type PeersKey struct { IPBytes string Port int } @@ -78,7 +78,7 @@ type torrent struct { // 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 @@ func (t *torrent) addPeer(p Peer, cl *Client) { 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 } -- 2.48.1