]> Sergey Matveev's repositories - btrtrc.git/commitdiff
connectionPruner should terminate when the torrent stops
authorMatt Joiner <anacrolix@gmail.com>
Thu, 29 Jan 2015 03:21:05 +0000 (14:21 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 29 Jan 2015 03:21:05 +0000 (14:21 +1100)
client.go

index ff8dbf4bf65abc82cc5727831ed20efff3f744a2..cd65f55de54994213f2b8c759148b0129b673c2b 100644 (file)
--- a/client.go
+++ b/client.go
@@ -1735,6 +1735,10 @@ func (cl *Client) connectionPruner(t *torrent) {
        for {
                time.Sleep(15 * time.Second)
                cl.mu.Lock()
+               select {
+               case <-t.ceasingNetworking:
+               default:
+               }
                license := len(t.Conns) - (socketsPerTorrent+1)/2
                for _, c := range t.Conns {
                        if license <= 0 {