forked from quic-go/quic-go
catch spurious UDP sendmsg errors in multiplex integration test (#4451)
* catch spurious UDP sendmsg errors in multiplex integration test * platform-dependent isPermissionError
This commit is contained in:
21
integrationtests/self/self_suite_linux_test.go
Normal file
21
integrationtests/self/self_suite_linux_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
//go:build linux
|
||||
|
||||
package self_test
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// The first sendmsg call on a new UDP socket sometimes errors on Linux.
|
||||
// It's not clear why this happens.
|
||||
// See https://github.com/golang/go/issues/63322.
|
||||
func isPermissionError(err error) bool {
|
||||
var serr *os.SyscallError
|
||||
if errors.As(err, &serr) {
|
||||
return serr.Syscall == "sendmsg" && serr.Err == unix.EPERM
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user