From b39df82fbc9269c69257ac22dea87338a886faf6 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 15 Sep 2017 19:10:09 +1000 Subject: [PATCH] Include peer data with half open connections --- client.go | 4 ++-- torrent.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index 2939b562..1fcc3c6e 100644 --- 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, diff --git a/torrent.go b/torrent.go index 7f04e5f3..5d6be261 100644 --- a/torrent.go +++ b/torrent.go @@ -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 -- 2.48.1