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
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue