]> Sergey Matveev's repositories - btrtrc.git/commitdiff
peersKey is a public type now
authorGleb Sinyavsky <zhulik.gleb@gmail.com>
Sun, 27 Dec 2015 12:27:32 +0000 (15:27 +0300)
committerGleb Sinyavsky <zhulik.gleb@gmail.com>
Sun, 27 Dec 2015 12:27:32 +0000 (15:27 +0300)
client.go
download.go
t.go
torrent.go

index 5e542e8e16e7d66ebc3b3ed32b0288fbda7ac200..a64b1f2288c63d860f55598d3da22c2c0a7a35c5 100644 (file)
--- 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{}),
index 171da56c7202fc019f1f6bbced5b501bf07d9cba..0a69c6a64f36cd0032c4194243c2e5166c6d7cfc 100644 (file)
@@ -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 9d2e7d1bc6777664cd096a4a009c52297e77885d..5f58703eb5eb88d043067f7f74db9b6bad95f4aa 100644 (file)
--- 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
index 26335e18a51718df6de0c06b35f2f82f5ded3a3c..242dfb8535baf68811f5f49ce94faf434495f209 100644 (file)
@@ -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
        }