diff options
Diffstat (limited to 'libgo/go/net/fd_poll_runtime.go')
-rw-r--r-- | libgo/go/net/fd_poll_runtime.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libgo/go/net/fd_poll_runtime.go b/libgo/go/net/fd_poll_runtime.go index 6c1d095bd7f..62b69fcbf15 100644 --- a/libgo/go/net/fd_poll_runtime.go +++ b/libgo/go/net/fd_poll_runtime.go @@ -7,6 +7,7 @@ package net import ( + "runtime" "sync" "syscall" "time" @@ -33,6 +34,7 @@ var serverInit sync.Once func (pd *pollDesc) init(fd *netFD) error { serverInit.Do(runtime_pollServerInit) ctx, errno := runtime_pollOpen(uintptr(fd.sysfd)) + runtime.KeepAlive(fd) if errno != 0 { return syscall.Errno(errno) } @@ -120,7 +122,7 @@ func (fd *netFD) setWriteDeadline(t time.Time) error { } func setDeadlineImpl(fd *netFD, t time.Time, mode int) error { - diff := int64(t.Sub(time.Now())) + diff := int64(time.Until(t)) d := runtimeNano() + diff if d <= 0 && diff > 0 { // If the user has a deadline in the future, but the delay calculation |