From a56b1ce6018a88ee7b3c146ff8d124c56aaed974 Mon Sep 17 00:00:00 2001
From: Ruben Pollan <meskio@sindominio.net>
Date: Thu, 6 Sep 2018 10:29:30 +0200
Subject: [PATCH] [feat] check regularly the status

Don't trust that the status will be reported by openvpn/bitmaskd
correctly. Let's do polling every 5 seconds.
---
 systray.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/systray.go b/systray.go
index 1281a776..7d242830 100644
--- a/systray.go
+++ b/systray.go
@@ -142,6 +142,13 @@ func (bt *bmTray) onReady() {
 				systray.Quit()
 			case <-signalCh:
 				systray.Quit()
+
+			case <-time.After(5 * time.Second):
+				if status, err := bt.bm.GetStatus(); err != nil {
+					log.Printf("Error getting status: %v", err)
+				} else {
+					bt.changeStatus(status)
+				}
 			}
 		}
 	}()
-- 
GitLab