From 1b381ccf7930286cc197cf08512774e23a0ebcc1 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Fri, 17 Sep 2021 14:43:21 +0200 Subject: [PATCH 1/2] remove useless struct --- go.mod | 5 +---- go.sum | 11 ----------- monitor.go | 10 ---------- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/go.mod b/go.mod index 2f34658..6a10043 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,4 @@ module github.com/arduino/pluggable-monitor-protocol-handler go 1.16 -require ( - github.com/arduino/go-properties-orderedmap v1.4.0 - github.com/hashicorp/go-multierror v1.1.1 -) +require github.com/hashicorp/go-multierror v1.1.1 diff --git a/go.sum b/go.sum index 7492bbd..6a62c36 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,4 @@ -github.com/arduino/go-paths-helper v1.0.1 h1:utYXLM2RfFlc9qp/MJTIYp3t6ux/xM6mWjeEb/WLK4Q= -github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck= -github.com/arduino/go-properties-orderedmap v1.4.0 h1:YEbbzPqm1gXWDM/Jaq8tlvmh09z2qeHPJTUw9/VA4Dk= -github.com/arduino/go-properties-orderedmap v1.4.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/monitor.go b/monitor.go index ad1fe1d..9c22b07 100644 --- a/monitor.go +++ b/monitor.go @@ -37,19 +37,9 @@ import ( "strings" "sync" - "github.com/arduino/go-properties-orderedmap" "github.com/hashicorp/go-multierror" ) -// Port is a descriptor for a board port -type Port struct { - Address string `json:"address"` - AddressLabel string `json:"label,omitempty"` - Protocol string `json:"protocol,omitempty"` - ProtocolLabel string `json:"protocolLabel,omitempty"` - Properties *properties.Map `json:"properties,omitempty"` -} - // Monitor is an interface that represents the business logic that // a pluggable monitor must implement. The communication protocol // is completely hidden and it's handled by a MonitorServer. From 18eb343d4c5130135d0fb05963b5b51ef076e185 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Fri, 17 Sep 2021 14:44:03 +0200 Subject: [PATCH 2/2] fix double CLOSE not printing anything --- monitor.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/monitor.go b/monitor.go index 9c22b07..5833216 100644 --- a/monitor.go +++ b/monitor.go @@ -252,8 +252,9 @@ func (d *Server) close(messageErr string) { d.closeFuncMutex.Lock() defer d.closeFuncMutex.Unlock() if d.clientConn == nil { - // TODO - // d.outputChan <- messageError("close", "port already closed") + if messageErr == "" { + d.outputChan <- messageError("close", "port already closed") + } return } connErr := d.clientConn.Close()