Commit 900d49bf authored by Mikio Hara's avatar Mikio Hara

net: make use of SO_LINGER_SEC on darwin

Fixes #7971.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/92210044
parent f4096819
......@@ -8,6 +8,7 @@ package net
import (
"os"
"runtime"
"syscall"
)
......@@ -137,5 +138,9 @@ func setLinger(fd *netFD, sec int) error {
return err
}
defer fd.decref()
return os.NewSyscallError("setsockopt", syscall.SetsockoptLinger(fd.sysfd, syscall.SOL_SOCKET, syscall.SO_LINGER, &l))
opt := syscall.SO_LINGER
if runtime.GOOS == "darwin" {
opt = syscall.SO_LINGER_SEC
}
return os.NewSyscallError("setsockopt", syscall.SetsockoptLinger(fd.sysfd, syscall.SOL_SOCKET, opt, &l))
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment