]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fixes to closing torrents and connections
authorMatt Joiner <anacrolix@gmail.com>
Thu, 28 Aug 2014 00:04:44 +0000 (10:04 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 28 Aug 2014 00:04:44 +0000 (10:04 +1000)
client.go

index 04087aaa21078671c0b17744161d613bca0056f3..048cc8a110f95305e4de8b4c6735da475d63689b 100644 (file)
--- 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