Skip to content

net: time unit used for TCP keep-alive on DragonFlyBSD should be seconds #65809

@panjf2000

Description

@panjf2000

After CL 542275 was merged into the master branch, I played around with this new feature along with investigating some known issues like #64251. As a result of which, I discovered a few issues and potential improvements on different platforms.

For the starter, DragonFlyBSD switched the time unit for TCP keep-alive from milliseconds to seconds since v5.8 while Go still uses milliseconds up to now (CL 542275 wasn't aware of it):

func setKeepAlivePeriod(fd *netFD, d time.Duration) error {
// The kernel expects milliseconds so round to next highest
// millisecond.
msecs := int(roundDurationUp(d, time.Millisecond))
if err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, msecs); err != nil {
return wrapSyscallError("setsockopt", err)
}
err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPIDLE, msecs)

I think that we need to keep Go in sync with that considering that Go makes no guarantee to support any older versions of DragonFlyBSD other than the latest one:

Generally only the latest release version only. We have a builder, but it’s not the most stable of our ports.

References:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions