internal/jsonrpc2_v2: update for go1.16+
Change-Id: If70bb4b7ab236ae921ff23d123cb38d476cfa665 Reviewed-on: https://go-review.googlesource.com/c/tools/+/676516 Auto-Submit: Robert Findley <rfindley@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
a08732fd0a
commit
df26370d22
3 changed files with 3 additions and 31 deletions
|
|
@ -100,14 +100,14 @@ func (l *netPiper) Accept(context.Context) (io.ReadWriteCloser, error) {
|
|||
// preferring the latter if already closed at the start of Accept.
|
||||
select {
|
||||
case <-l.done:
|
||||
return nil, errClosed
|
||||
return nil, net.ErrClosed
|
||||
default:
|
||||
}
|
||||
select {
|
||||
case rwc := <-l.dialed:
|
||||
return rwc, nil
|
||||
case <-l.done:
|
||||
return nil, errClosed
|
||||
return nil, net.ErrClosed
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,6 +133,6 @@ func (l *netPiper) Dial(ctx context.Context) (io.ReadWriteCloser, error) {
|
|||
case <-l.done:
|
||||
client.Close()
|
||||
server.Close()
|
||||
return nil, errClosed
|
||||
return nil, net.ErrClosed
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright 2022 The Go MCP SDK Authors. All rights reserved.
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
|
||||
package jsonrpc2
|
||||
|
||||
import (
|
||||
"net"
|
||||
)
|
||||
|
||||
var errClosed = net.ErrClosed
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright 2020 The Go MCP SDK Authors. All rights reserved.
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !go1.16
|
||||
|
||||
package jsonrpc2
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
// errClosed is an error with the same string as net.ErrClosed,
|
||||
// which was added in Go 1.16.
|
||||
var errClosed = errors.New("use of closed network connection")
|
||||
Loading…
Reference in a new issue