From 9b56d5f1ce13ecbb31714a4bb557358bca860ee8 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 1 Oct 2017 08:14:54 -0700 Subject: [PATCH] plugins/autohttpagent: fix for ln api change --- plugins/autohttpagent/main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/autohttpagent/main.go b/plugins/autohttpagent/main.go index 87ccc4d..4dc1926 100644 --- a/plugins/autohttpagent/main.go +++ b/plugins/autohttpagent/main.go @@ -1,6 +1,9 @@ +// +build linux + package main import ( + "context" "crypto/tls" "log" "os" @@ -31,6 +34,9 @@ func mustEnv(key string, def string) string { func doHttpAgent() { go func() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + cfg := &tun2.ClientConfig{ TLSConfig: &tls.Config{}, ConnType: connMethod, @@ -43,9 +49,7 @@ func doHttpAgent() { client, _ := tun2.NewClient(cfg) err := client.Connect() if err != nil { - ln.Error(err, ln.F{ - "action": "client_running", - }) + ln.Error(ctx, err, ln.Action("client connection error, restarting")) time.Sleep(5 * time.Second)