From: Matt Joiner Date: Thu, 28 Aug 2014 00:04:44 +0000 (+1000) Subject: Fixes to closing torrents and connections X-Git-Tag: v1.0.0~1579 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=e09e21fab2306353647785c2f4de626f3c011a88;p=btrtrc.git Fixes to closing torrents and connections --- 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