aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syncthing/st.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-08-24 21:45:32 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-08-24 21:45:32 +0200
commit3f0a0e6f9cf9e5963d89c6d1be515d8f43ee08bb (patch)
tree33d8915b02b7146b4898ae1cdd595db14e9ec3b7 /lib/syncthing/st.go
parent347bd1674bbf67ccb6209951a4bf8f2971715532 (diff)
Take care of ST connection lost in ST event monitor.
Diffstat (limited to 'lib/syncthing/st.go')
-rw-r--r--lib/syncthing/st.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/syncthing/st.go b/lib/syncthing/st.go
index b622970..5086994 100644
--- a/lib/syncthing/st.go
+++ b/lib/syncthing/st.go
@@ -27,12 +27,13 @@ import (
// SyncThing .
type SyncThing struct {
- BaseURL string
- APIKey string
- Home string
- STCmd *exec.Cmd
- STICmd *exec.Cmd
- MyID string
+ BaseURL string
+ APIKey string
+ Home string
+ STCmd *exec.Cmd
+ STICmd *exec.Cmd
+ MyID string
+ Connected bool
// Private fields
binDir string
@@ -301,6 +302,7 @@ func (s *SyncThing) StopInotify() {
// Connect Establish HTTP connection with Syncthing
func (s *SyncThing) Connect() error {
var err error
+ s.Connected = false
s.client, err = common.HTTPNewClient(s.BaseURL,
common.HTTPClientConfig{
URLPrefix: "/rest",
@@ -327,6 +329,8 @@ func (s *SyncThing) Connect() error {
return fmt.Errorf("ERROR: cannot retrieve ID")
}
+ s.Connected = true
+
// Start events monitoring
err = s.Events.Start()