From 8b1e2ba0fa733000dff446d6fe17b2ad00fe1943 Mon Sep 17 00:00:00 2001 From: wuxingzhong <330332812@qq.com> Date: Thu, 8 Aug 2019 16:13:39 +0800 Subject: [PATCH 1/5] judge if interface is up --- pkg/net/ip/ip.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/net/ip/ip.go b/pkg/net/ip/ip.go index 54e241d1a..386d7e23f 100644 --- a/pkg/net/ip/ip.go +++ b/pkg/net/ip/ip.go @@ -48,6 +48,9 @@ func InternalIP() string { return "" } for _, inter := range inters { + if !isUp(inter.Flags) { + continue + } if !strings.HasPrefix(inter.Name, "lo") { addrs, err := inter.Addrs() if err != nil { @@ -64,3 +67,8 @@ func InternalIP() string { } return "" } + +// isUp Interface is up +func isUp(v net.Flags) bool { + return v&net.FlagUp == net.FlagUp +} From 443042feee2b924fcea3e6a8da888c4a4488c040 Mon Sep 17 00:00:00 2001 From: wuxingzhong <330332812@qq.com> Date: Fri, 23 Aug 2019 14:58:57 +0800 Subject: [PATCH 2/5] modify log --- pkg/net/http/blademaster/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/net/http/blademaster/server.go b/pkg/net/http/blademaster/server.go index f934dabcd..29b47f2eb 100644 --- a/pkg/net/http/blademaster/server.go +++ b/pkg/net/http/blademaster/server.go @@ -163,7 +163,7 @@ type injection struct { func NewServer(conf *ServerConfig) *Engine { if conf == nil { if !flag.Parsed() { - fmt.Fprint(os.Stderr, "[blademaster] please call flag.Parse() before Init warden server, some configure may not effect.\n") + fmt.Fprint(os.Stderr, "[blademaster] please call flag.Parse() before Init blademaster server, some configure may not effect.\n") } conf = parseDSN(_httpDSN) } From 6d3de81a582ff2d8e5b59bb66da8fd4871886aeb Mon Sep 17 00:00:00 2001 From: wuxingzhong <330332812@qq.com> Date: Thu, 8 Aug 2019 16:13:39 +0800 Subject: [PATCH 3/5] judge if interface is up --- pkg/net/ip/ip.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/net/ip/ip.go b/pkg/net/ip/ip.go index 0966ccc5e..f9d572628 100644 --- a/pkg/net/ip/ip.go +++ b/pkg/net/ip/ip.go @@ -66,6 +66,7 @@ func InternalIP() string { } } return "" + } // isUp Interface is up From 821da8a54f490a91ae7202074d569da86aeb50f1 Mon Sep 17 00:00:00 2001 From: wuxingzhong <330332812@qq.com> Date: Tue, 7 Jan 2020 16:38:25 +0800 Subject: [PATCH 4/5] modify discovery --- pkg/naming/discovery/discovery.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/naming/discovery/discovery.go b/pkg/naming/discovery/discovery.go index 088304d25..5b8c8c241 100644 --- a/pkg/naming/discovery/discovery.go +++ b/pkg/naming/discovery/discovery.go @@ -601,7 +601,9 @@ func (d *Discovery) polls(ctx context.Context) (apps map[string]*naming.Instance } if err = d.httpClient.Get(ctx, uri, "", params, res); err != nil { d.switchNode() - log.Error("discovery: client.Get(%s) error(%+v)", uri+"?"+params.Encode(), err) + if ctx.Err() != context.Canceled { + log.Error("discovery: client.Get(%s) error(%+v)", uri+"?"+params.Encode(), err) + } return } if ec := ecode.Int(res.Code); !ecode.Equal(ecode.OK, ec) { From a5fd66410831a29d0bfea98666d9d8d8c276c586 Mon Sep 17 00:00:00 2001 From: wuxingzhong <330332812@qq.com> Date: Tue, 7 Jan 2020 16:58:51 +0800 Subject: [PATCH 5/5] del space line --- pkg/net/ip/ip.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/net/ip/ip.go b/pkg/net/ip/ip.go index f9d572628..0966ccc5e 100644 --- a/pkg/net/ip/ip.go +++ b/pkg/net/ip/ip.go @@ -66,7 +66,6 @@ func InternalIP() string { } } return "" - } // isUp Interface is up