mirror of
https://github.com/golang/net.git
synced 2026-03-31 10:27:08 +09:00
internal/socket: check for EWOULDBLOCK on all platforms
Don't make the check for EWOULDBLOCK zos-specific. Most platforms define EAGAIN and EWOULDBLOCK with the same underlying value. Thus, the additional check will be a no-op on them. On platforms where EAGAIN and EWOULDBLOCK have different underlying values, we probably want to check both as well. As pointed out by Michael Munday in CL 264028. Change-Id: Id3404fc4440c66a3484975b4c94b4ebb788b80a1 Reviewed-on: https://go-review.googlesource.com/c/net/+/295569 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
9060382bd4
commit
3d97a244fc
@@ -9,7 +9,6 @@ package socket
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
@@ -26,7 +25,7 @@ func (c *Conn) recvMsg(m *Message, flags int) error {
|
||||
var n int
|
||||
fn := func(s uintptr) bool {
|
||||
n, operr = recvmsg(s, &h, flags)
|
||||
if operr == syscall.EAGAIN || (runtime.GOOS == "zos" && operr == syscall.EWOULDBLOCK) {
|
||||
if operr == syscall.EAGAIN || operr == syscall.EWOULDBLOCK {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -63,7 +62,7 @@ func (c *Conn) sendMsg(m *Message, flags int) error {
|
||||
var n int
|
||||
fn := func(s uintptr) bool {
|
||||
n, operr = sendmsg(s, &h, flags)
|
||||
if operr == syscall.EAGAIN || (runtime.GOOS == "zos" && operr == syscall.EWOULDBLOCK) {
|
||||
if operr == syscall.EAGAIN || operr == syscall.EWOULDBLOCK {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user