lib/syncthing: Refactor to use util.AsService (#5858)

This commit is contained in:
Simon Frei
2019-07-23 10:50:37 +02:00
committed by GitHub
parent 942659fb06
commit 7b3d9a8dca
4 changed files with 35 additions and 73 deletions

View File

@@ -126,7 +126,7 @@ func (a *App) startup() error {
l.SetPrefix("[start] ")
if a.opts.AuditWriter != nil {
a.startAuditing()
a.mainService.Add(newAuditService(a.opts.AuditWriter))
}
if a.opts.Verbose {
@@ -418,15 +418,6 @@ func (a *App) Stop(stopReason ExitStatus) ExitStatus {
return a.exitStatus
}
func (a *App) startAuditing() {
auditService := newAuditService(a.opts.AuditWriter)
a.mainService.Add(auditService)
// We wait for the audit service to fully start before we return, to
// ensure we capture all events from the start.
auditService.WaitForStart()
}
func (a *App) setupGUI(m model.Model, defaultSub, diskSub events.BufferedSubscription, discoverer discover.CachingMux, connectionsService connections.Service, urService *ur.Service, errors, systemLog logger.Recorder) error {
guiCfg := a.cfg.GUI()