diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-08-18 01:04:02 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-08-18 01:04:02 +0200 |
commit | 8f44cc7217ce48f3f94c8ea3f037cdf011c4493b (patch) | |
tree | a93c483370e6ad64a7440241cfb7c21beb6021ba /lib/syncthing/st.go | |
parent | 4feef5296bf3aea331fdde4cd7b94ee2322a907e (diff) |
Add folder synchronization status.
Also add ability to force re-synchronization.
Diffstat (limited to 'lib/syncthing/st.go')
-rw-r--r-- | lib/syncthing/st.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/syncthing/st.go b/lib/syncthing/st.go index 9bdb48f..10210a4 100644 --- a/lib/syncthing/st.go +++ b/lib/syncthing/st.go @@ -42,6 +42,7 @@ type SyncThing struct { conf *xdsconfig.Config client *common.HTTPClient log *logrus.Logger + Events *Events } // ExitChan Channel used for process exit @@ -126,6 +127,9 @@ func NewSyncThing(conf *xdsconfig.Config, log *logrus.Logger) *SyncThing { conf: conf, } + // Create Events monitoring + s.Events = s.NewEventListener() + return &s } @@ -316,6 +320,12 @@ func (s *SyncThing) Connect() error { s.client.SetLogger(s.log) s.MyID, err = s.IDGet() + if err != nil { + return fmt.Errorf("ERROR: cannot retrieve ID") + } + + // Start events monitoring + err = s.Events.Start() return err } |