]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Include peer data with half open connections
authorMatt Joiner <anacrolix@gmail.com>
Fri, 15 Sep 2017 09:10:09 +0000 (19:10 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 15 Sep 2017 09:10:09 +0000 (19:10 +1000)
client.go
torrent.go

index 2939b56267aa1dd18b456acb59f3cb3a4eb4d7ad..1fcc3c6e2ea3e88ea57020bfeaf20cb405d5a309 100644 (file)
--- a/client.go
+++ b/client.go
@@ -512,7 +512,7 @@ func (cl *Client) initiateConn(peer Peer, t *Torrent) {
        if t.addrActive(addr) {
                return
        }
-       t.halfOpen[addr] = struct{}{}
+       t.halfOpen[addr] = peer
        go cl.outgoingConnection(t, addr, peer.Source)
 }
 
@@ -1215,7 +1215,7 @@ func (cl *Client) newTorrent(ih metainfo.Hash, specStorage storage.ClientImpl) (
                peers:    make(map[peersKey]Peer),
                conns:    make(map[*connection]struct{}, 2*defaultEstablishedConnsPerTorrent),
 
-               halfOpen:          make(map[string]struct{}),
+               halfOpen:          make(map[string]Peer),
                pieceStateChanges: pubsub.NewPubSub(),
 
                storageOpener:       storageClient,
index 7f04e5f3aae1c62568fef25a2cefc1e4124517f8..5d6be261d7987af179f555a4c7ac28953724dff2 100644 (file)
@@ -72,7 +72,7 @@ type Torrent struct {
        maxEstablishedConns int
        // Set of addrs to which we're attempting to connect. Connections are
        // half-open until all handshakes are completed.
-       halfOpen map[string]struct{}
+       halfOpen map[string]Peer
 
        // 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