plugins/autohttpagent: retry everything
This commit is contained in:
parent
47ba6d6abe
commit
e1e255b138
|
@ -32,7 +32,7 @@ func mustEnv(key string, def string) string {
|
||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
func doHttpAgent() {
|
func doHTTPAgent() {
|
||||||
go func() {
|
go func() {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -47,17 +47,17 @@ func doHttpAgent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
client, _ := tun2.NewClient(cfg)
|
client, _ := tun2.NewClient(cfg)
|
||||||
err := client.Connect()
|
err := client.Connect(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ln.Error(ctx, err, ln.Action("client connection error, restarting"))
|
ln.Error(ctx, err, ln.Action("client connection error, restarting"))
|
||||||
|
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
|
|
||||||
doHttpAgent()
|
doHTTPAgent()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
doHttpAgent()
|
doHTTPAgent()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue