1 //go:build !windows && !wasm
8 "golang.org/x/sys/unix"
11 func setReusePortSockOpts(fd uintptr) (err error) {
12 // I would use libp2p/go-reuseport to do this here, but no surprise it's
13 // implemented incorrectly.
15 // Looks like we can get away with just REUSEPORT at least on Darwin, and probably by
16 // extension BSDs and Linux.
18 err = syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
23 err = syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEPORT, 1)
27 func setSockNoLinger(fd uintptr) (err error) {
28 return syscall.SetsockoptLinger(int(fd), syscall.SOL_SOCKET, syscall.SO_LINGER, &lingerOffVal)