Commit 4e0f6394 authored by Ian Lance Taylor's avatar Ian Lance Taylor

net: use internal/poll for DragonFly setKeepAlivePeriod

Fixes DragonFly build.

Change-Id: Id6b439cd4023ea8e3ed7cd9b70eec553c9eee4be
Reviewed-on: https://go-review.googlesource.com/36916
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent fc13da16
...@@ -5,22 +5,20 @@ ...@@ -5,22 +5,20 @@
package net package net
import ( import (
"os" "runtime"
"syscall" "syscall"
"time" "time"
) )
func setKeepAlivePeriod(fd *netFD, d time.Duration) error { func setKeepAlivePeriod(fd *netFD, d time.Duration) error {
if err := fd.incref(); err != nil {
return err
}
defer fd.decref()
// The kernel expects milliseconds so round to next highest // The kernel expects milliseconds so round to next highest
// millisecond. // millisecond.
d += (time.Millisecond - time.Nanosecond) d += (time.Millisecond - time.Nanosecond)
msecs := int(d / time.Millisecond) msecs := int(d / time.Millisecond)
if err := syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, msecs); err != nil { if err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, msecs); err != nil {
return os.NewSyscallError("setsockopt", err) return wrapSyscallError("setsockopt", err)
} }
return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPIDLE, msecs)) err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPIDLE, msecs)
runtime.KeepAlive(fd)
return wrapSyscallError("setsockopt", err)
} }
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