diff --git a/bitmask/main.go b/bitmask/main.go index a6452ca014c1fe13a480c7d51fcd3bb75e81c2c0..b101367b17fff136ca156b392fade959aba35b0e 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 b7faa91e4a5caadc2c0a11c13842e365a6307efd..2caa1fa8a6e0bc3b098fd96b61127c22f2377df6 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) }