1
0
mirror of https://github.com/golang/go synced 2024-11-19 12:14:42 -07:00

net: drop special case for macOS 10.7 and earlier

Updates #23122

Change-Id: Ia2c869a140c8ee01b5861897e4706389950d387e
Reviewed-on: https://go-review.googlesource.com/116156
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Tobias Klauser 2018-06-04 20:06:30 +02:00 committed by Tobias Klauser
parent d6c3b0a56d
commit d0228b03bd

View File

@ -16,9 +16,7 @@ func setKeepAlivePeriod(fd *netFD, d time.Duration) error {
// The kernel expects seconds so round to next highest second. // The kernel expects seconds so round to next highest second.
d += (time.Second - time.Nanosecond) d += (time.Second - time.Nanosecond)
secs := int(d.Seconds()) secs := int(d.Seconds())
switch err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, sysTCP_KEEPINTVL, secs); err { if err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, sysTCP_KEEPINTVL, secs); err != nil {
case nil, syscall.ENOPROTOOPT: // OS X 10.7 and earlier don't support this option
default:
return wrapSyscallError("setsockopt", err) return wrapSyscallError("setsockopt", err)
} }
err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPALIVE, secs) err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPALIVE, secs)