summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2018-02-13 12:48:11 +0100
committerRuben Pollan <meskio@sindominio.net>2018-02-13 12:48:11 +0100
commit340834baecb0521bde93623fb2449720ce79b1f6 (patch)
tree327eee54d7cce13a75ced7f5837d8110585083c9
parent3b4c2e8c5767d3bbc1a1963a4ffc956d2dc0fcfb (diff)
Close bitmask when the systray quits
-rw-r--r--bitmask/main.go5
-rw-r--r--main.go1
2 files changed, 6 insertions, 0 deletions
diff --git a/bitmask/main.go b/bitmask/main.go
index a6452ca..b101367 100644
--- a/bitmask/main.go
+++ b/bitmask/main.go
@@ -3,6 +3,7 @@ package bitmask
import (
"encoding/json"
"errors"
+ "log"
"github.com/pebbe/zmq4"
)
@@ -43,6 +44,10 @@ func (b *Bitmask) GetStatusCh() chan string {
// Close the connection to bitmask
func (b *Bitmask) Close() {
+ _, err := b.send("core", "stop")
+ if err != nil {
+ log.Printf("Got an error stopping bitmaskd: %v", err)
+ }
b.coresoc.Close()
}
diff --git a/main.go b/main.go
index b7faa91..2caa1fa 100644
--- a/main.go
+++ b/main.go
@@ -22,6 +22,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
+ defer b.Close()
run(b, conf)
}