client.go | 4 ++-- torrent.go | 2 +- diff --git a/client.go b/client.go index 2939b56267aa1dd18b456acb59f3cb3a4eb4d7ad..1fcc3c6e2ea3e88ea57020bfeaf20cb405d5a309 100644 --- a/client.go +++ b/client.go @@ -512,7 +512,7 @@ addr := net.JoinHostPort(peer.IP.String(), fmt.Sprintf("%d", peer.Port)) if t.addrActive(addr) { return } - t.halfOpen[addr] = struct{}{} + t.halfOpen[addr] = peer go cl.outgoingConnection(t, addr, peer.Source) } @@ -1215,7 +1215,7 @@ infoHash: ih, 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 7f04e5f3aae1c62568fef25a2cefc1e4124517f8..5d6be261d7987af179f555a4c7ac28953724dff2 100644 --- a/torrent.go +++ b/torrent.go @@ -72,7 +72,7 @@ conns map[*connection]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