summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bitmask/main.go4
-rw-r--r--main.go3
-rw-r--r--notificator.go5
3 files changed, 11 insertions, 1 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
diff --git a/main.go b/main.go
index 82a3a9e..9938359 100644
--- a/main.go
+++ b/main.go
@@ -49,7 +49,8 @@ func checkAndInstallHelpers(b *bitmask.Bitmask, notify *notificator) {
log.Printf("No polkit found")
notify.authAgent()
} else if err != nil {
- log.Fatal(err)
+ notify.bitmaskNotRunning()
+ log.Fatal("Is bitmask running? ", err)
}
if !helpers {
diff --git a/notificator.go b/notificator.go
index dce1a79..375b883 100644
--- a/notificator.go
+++ b/notificator.go
@@ -26,6 +26,7 @@ import (
const (
donationText = `The RiseupVPN service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month at https://riseup.net/donate-vpn`
missingAuthAgent = `Could not find a polkit authentication agent. Please run one and try again.`
+ notRunning = `Is bitmaskd running? Start bitmask and try again.`
)
type notificator struct {
@@ -55,6 +56,10 @@ func (n *notificator) donations() {
}
}
+func (n *notificator) bitmaskNotRunning() {
+ n.notify.Push("Can't contact bitmask", notRunning, "", notif.UR_CRITICAL)
+}
+
func (n *notificator) authAgent() {
n.notify.Push("Missing authentication agent", missingAuthAgent, "", notif.UR_CRITICAL)
}