From 11b2ca66e3cfed22d62a3cb48c4485e6a3b548a2 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Wed, 14 Feb 2018 01:28:55 +0100 Subject: [feat] timeout if bitmaskd doesn't respond - Resolves: #7 --- bitmask/main.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bitmask') diff --git a/bitmask/main.go b/bitmask/main.go index 4efaae1..185c3a0 100644 --- a/bitmask/main.go +++ b/bitmask/main.go @@ -19,6 +19,7 @@ import ( "encoding/json" "errors" "log" + "time" "github.com/pebbe/zmq4" ) @@ -26,6 +27,7 @@ import ( const ( // On win should be: tcp://127.0.0.1:5001 coreEndpoint = "ipc:///tmp/bitmask.core.sock" + timeout = time.Second * 40 ) // Bitmask holds the bitmask client data @@ -47,6 +49,8 @@ func Init() (*Bitmask, error) { return nil, err } + coresoc.SetRcvtimeo(timeout) + b := Bitmask{coresoc, eventsoc, statusCh} go b.eventsHandler() return &b, nil -- cgit v1.2.3