"github.com/codegangsta/cli"
"github.com/iotbzh/xds-agent/lib/agent"
"github.com/iotbzh/xds-agent/lib/syncthing"
+ "github.com/iotbzh/xds-agent/lib/webserver"
"github.com/iotbzh/xds-agent/lib/xdsconfig"
- "github.com/iotbzh/xds-agent/lib/xdsserver"
)
const (
// Establish connection with local Syncthing (retry if connection fail)
time.Sleep(3 * time.Second)
- retry := 10
+ maxRetry := 30
+ retry := maxRetry
for retry > 0 {
if err := ctx.SThg.Connect(); err == nil {
break
}
- ctx.Log.Infof("Establishing connection to Syncthing (retry %d/10)", retry)
+ ctx.Log.Infof("Establishing connection to Syncthing (retry %d/%d)", retry, maxRetry)
time.Sleep(time.Second)
retry--
}
ctx.Log.Infof("Local Syncthing ID: %s", id)
// Create and start Web Server
- ctx.WWWServer = xdsserver.NewServer(ctx.Config, ctx.Log)
+ ctx.WWWServer = webserver.New(ctx.Config, ctx.Log)
if err = ctx.WWWServer.Serve(); err != nil {
log.Println(err)
return cli.NewExitError(err, 3)