From e0c02e061c21960a81d1333f71fc993139899747 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Tue, 14 Nov 2023 09:49:42 -0500 Subject: [PATCH] Tweak logging and update deps --- cmd/channel/subcmd/memory/run.go | 2 +- cmd/channel/subcmd/root.go | 4 ++-- go.mod | 8 ++++---- go.sum | 18 +++++++++--------- impl.go | 10 ++++++---- ping.go | 1 - priority.go | 1 - 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/cmd/channel/subcmd/memory/run.go b/cmd/channel/subcmd/memory/run.go index 03a125e..5e7a1c4 100644 --- a/cmd/channel/subcmd/memory/run.go +++ b/cmd/channel/subcmd/memory/run.go @@ -21,8 +21,8 @@ import ( "github.com/openziti/channel/v2" "github.com/openziti/channel/v2/cmd/channel/subcmd" "github.com/openziti/channel/v2/memory" - "github.com/openziti/identity/dotziti" "github.com/openziti/identity" + "github.com/openziti/identity/dotziti" "github.com/spf13/cobra" "time" ) diff --git a/cmd/channel/subcmd/root.go b/cmd/channel/subcmd/root.go index 8014b3d..9f31ffa 100644 --- a/cmd/channel/subcmd/root.go +++ b/cmd/channel/subcmd/root.go @@ -28,7 +28,7 @@ func init() { } var Root = &cobra.Command{ - Use: filepath.Base(os.Args[0]), + Use: filepath.Base(os.Args[0]), Short: "Channel2 Toolbox", PersistentPreRun: func(_ *cobra.Command, _ []string) { if verbose { @@ -36,4 +36,4 @@ var Root = &cobra.Command{ } }, } -var verbose bool \ No newline at end of file +var verbose bool diff --git a/go.mod b/go.mod index 48ad172..7302150 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,14 @@ module github.com/openziti/channel/v2 go 1.19 require ( - github.com/gorilla/websocket v1.5.0 + github.com/gorilla/websocket v1.5.1 github.com/michaelquigley/pfxlog v0.6.10 - github.com/openziti/foundation/v2 v2.0.33 + github.com/openziti/foundation/v2 v2.0.34 github.com/openziti/identity v1.0.66 github.com/openziti/transport/v2 v2.0.114 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 - github.com/spf13/cobra v1.7.0 + github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.4 google.golang.org/protobuf v1.31.0 ) @@ -22,7 +22,7 @@ require ( github.com/gorilla/mux v1.8.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/miekg/pkcs11 v1.1.1 // indirect github.com/openziti/dilithium v0.3.3 // indirect diff --git a/go.sum b/go.sum index 0a9aea8..1680d1a 100644 --- a/go.sum +++ b/go.sum @@ -79,7 +79,7 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -196,8 +196,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= @@ -279,8 +279,8 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= @@ -325,8 +325,8 @@ github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k= github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo= -github.com/openziti/foundation/v2 v2.0.33 h1:8CP+fi4KsmzA4jDi54jibwFWWxKpd0rSiplzN9Z0Isw= -github.com/openziti/foundation/v2 v2.0.33/go.mod h1:dWR0g3NOka3uKz9MgUHq6dmuRLmSvunkyeuOXEW/5qU= +github.com/openziti/foundation/v2 v2.0.34 h1:rJm1+zPRCCn8jk8r8LQimhOs9ONBeoAeemI9/tQ3oGs= +github.com/openziti/foundation/v2 v2.0.34/go.mod h1:n5zq4T1e0GD6TkkUshmMa50zIsEG8mzam6xlennM3WE= github.com/openziti/identity v1.0.66 h1:wCIVNCoiHmeicC9yM15FC0xe6jSic879ztN63fSD6hM= github.com/openziti/identity v1.0.66/go.mod h1:grReHVqBwhECrnrAZCxNw4ZpA2I1ox66tYfPkfGuKJY= github.com/openziti/transport/v2 v2.0.114 h1:avL4MJq7gJIjjvC1yeiKbAUrPIjVaKJQnLkDLb5uXe8= @@ -409,8 +409,8 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= diff --git a/impl.go b/impl.go index 0c8e12c..54aef4d 100644 --- a/impl.go +++ b/impl.go @@ -243,7 +243,7 @@ func (channel *channelImpl) Send(s Sendable) error { select { case <-s.Context().Done(): if err := s.Context().Err(); err != nil { - return TimeoutError{error: errors.Wrap(err, "timeout waiting for message reply")} + return TimeoutError{error: errors.Wrap(err, "timeout waiting to put message in send queue")} } return TimeoutError{error: errors.New("timeout waiting to put message in send queue")} case <-channel.closeNotify: @@ -263,7 +263,7 @@ func (channel *channelImpl) TrySend(s Sendable) (bool, error) { select { case <-s.Context().Done(): if err := s.Context().Err(); err != nil { - return false, TimeoutError{errors.Wrap(err, "timeout waiting for message reply")} + return false, TimeoutError{errors.Wrap(err, "timeout waiting to put message in send queue")} } return false, TimeoutError{error: errors.New("timeout waiting to put message in send queue")} case <-channel.closeNotify: @@ -318,9 +318,11 @@ func (channel *channelImpl) rxer() { m, err := channel.underlay.Rx() if err != nil { if err == io.EOF { - log.Debug("EOF") + log.WithError(err).Debug("EOF") + } else if channel.IsClosed() { + log.WithError(err).Debug("rx error") } else { - log.Errorf("rx error (%s)", err) + log.WithError(err).Error("rx error") } return } diff --git a/ping.go b/ping.go index ecba0a3..0fab332 100644 --- a/ping.go +++ b/ping.go @@ -21,7 +21,6 @@ import ( ) // pingHandler responds to Ping messages with Result messages. -// type pingHandler struct{} func (h *pingHandler) ContentType() int32 { diff --git a/priority.go b/priority.go index fdd405b..80ff78f 100644 --- a/priority.go +++ b/priority.go @@ -33,7 +33,6 @@ func (pq priorityHeap) Len() int { // Less sorts by sequence if the priority is equivalent, otherwise sorts by priority. This ensures that we don't beat // up the egress ordering buffer. We send packets in sequence order, unless priority is implicated. -// func (pq priorityHeap) Less(i, j int) bool { if pq[i].Priority() == pq[j].Priority() { return pq[i].Sequence() < pq[j].Sequence()