plugins/autohttpagent: retry everything

This commit is contained in:
Cadey Ratio 2017-10-05 13:15:24 -07:00
parent 47ba6d6abe
commit e1e255b138
1 changed files with 4 additions and 4 deletions

View File

@ -32,7 +32,7 @@ func mustEnv(key string, def string) string {
return val
}
func doHttpAgent() {
func doHTTPAgent() {
go func() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@ -47,17 +47,17 @@ func doHttpAgent() {
}
client, _ := tun2.NewClient(cfg)
err := client.Connect()
err := client.Connect(ctx)
if err != nil {
ln.Error(ctx, err, ln.Action("client connection error, restarting"))
time.Sleep(5 * time.Second)
doHttpAgent()
doHTTPAgent()
}
}()
}
func init() {
doHttpAgent()
doHTTPAgent()
}