mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
23 lines
500 B
Go
23 lines
500 B
Go
//go:build !windows
|
|
// +build !windows
|
|
|
|
package transport
|
|
|
|
import (
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func setReusePort(network, address string, conn syscall.RawConn) error {
|
|
return conn.Control(func(fd uintptr) {
|
|
syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEPORT, 1)
|
|
})
|
|
}
|
|
|
|
func setReuseAddress(network, address string, conn syscall.RawConn) error {
|
|
return conn.Control(func(fd uintptr) {
|
|
syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEADDR, 1)
|
|
})
|
|
}
|