Source file
src/net/tcpsockopt_dragonfly.go
1
2
3
4
5 package net
6
7 import (
8 "runtime"
9 "syscall"
10 "time"
11 )
12
13 func setKeepAlivePeriod(fd *netFD, d time.Duration) error {
14
15
16 msecs := int(roundDurationUp(d, time.Millisecond))
17 if err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, msecs); err != nil {
18 return wrapSyscallError("setsockopt", err)
19 }
20 err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPIDLE, msecs)
21 runtime.KeepAlive(fd)
22 return wrapSyscallError("setsockopt", err)
23 }
24
View as plain text