summaryrefslogtreecommitdiff
path: root/bitmask/main.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2018-02-14 01:28:55 +0100
committerRuben Pollan <meskio@sindominio.net>2018-02-14 10:46:59 +0100
commit11b2ca66e3cfed22d62a3cb48c4485e6a3b548a2 (patch)
tree37fb7de83659a84fcc6a3b22a326dead2a4941ab /bitmask/main.go
parenta52abd0c722ec08cd95c8c9be76e27a04012b282 (diff)
[feat] timeout if bitmaskd doesn't respond
- Resolves: #7
Diffstat (limited to 'bitmask/main.go')
-rw-r--r--bitmask/main.go4
1 files changed, 4 insertions, 0 deletions
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