From e09e21fab2306353647785c2f4de626f3c011a88 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 28 Aug 2014 10:04:44 +1000 Subject: [PATCH] Fixes to closing torrents and connections --- client.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client.go b/client.go index 04087aaa..048cc8a1 100644 --- a/client.go +++ b/client.go @@ -267,9 +267,7 @@ func (me *Client) Stop() { close(me.quit) me.event.Broadcast() for _, t := range me.torrents { - for _, c := range t.Conns { - c.Close() - } + t.Close() } me.mu.Unlock() } @@ -929,10 +927,10 @@ func (me *Client) connectionLoop(t *torrent, c *connection) error { } func (me *Client) dropConnection(torrent *torrent, conn *connection) { - conn.Socket.Close() for r := range conn.Requests { me.connDeleteRequest(torrent, conn, r) } + conn.Close() for i0, c := range torrent.Conns { if c != conn { continue