internal/jsonrpc2_v2: make TestIdleTimeout pass on Plan 9
Fixes golang/go#46175 Change-Id: I9c801ff42392dbff2fcb74dea7549d849c7e3624 Reviewed-on: https://go-review.googlesource.com/c/tools/+/323529 Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ian Cottrell <iancottrell@google.com> Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
b619c1cc78
commit
facfa16e73
1 changed files with 13 additions and 0 deletions
|
|
@ -7,7 +7,10 @@ package jsonrpc2
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
errors "golang.org/x/xerrors"
|
errors "golang.org/x/xerrors"
|
||||||
|
|
@ -155,6 +158,16 @@ func isClosingError(err error) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if runtime.GOOS == "plan9" {
|
||||||
|
// Error reading from a closed connection.
|
||||||
|
if err == syscall.EINVAL {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// Error trying to accept a new connection from a closed listener.
|
||||||
|
if strings.HasSuffix(err.Error(), " listen hungup") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue