]> Sergey Matveev's repositories - btrtrc.git/blobdiff - cmd/btrtrc/txstats.go
Simpler cancellation with global variables
[btrtrc.git] / cmd / btrtrc / txstats.go
index 6ce62bab4ae918679de0dba13c4ad24702a2ef56..f05a4b8fd2955270075c06a56f82ef5fc6e24e69 100644 (file)
@@ -60,13 +60,13 @@ func txStatsDumpAll(c *torrent.Client) {
        }
 }
 
-func txStatsDumper(c *torrent.Client, cancel chan struct{}) {
+func txStatsDumper(c *torrent.Client) {
        tick := time.Tick(10 * time.Second)
        for {
                txStatsDumpAll(c)
                select {
-               case <-cancel:
-                       close(cancel)
+               case <-Cancel:
+                       Jobs.Done()
                        return
                case <-tick:
                }