feat: enable listen TIME_WAIT port

This commit is contained in:
icey-yu
2024-09-04 19:23:39 +08:00
parent 076205a290
commit 5555f31961
3 changed files with 53 additions and 7 deletions
+1 -7
View File
@@ -55,13 +55,7 @@ func Start[T any](ctx context.Context, discovery *config.Discovery, prometheusCo
"prometheusPorts", prometheusConfig.Ports)
rpcTcpAddr := net.JoinHostPort(network.GetListenIP(listenIP), strconv.Itoa(rpcPort))
lc := net.ListenConfig{
Control: func(network, address string, conn syscall.RawConn) error {
return conn.Control(func(fd uintptr) {
_ = syscall.SetsockoptInt(syscall.Handle(fd), syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
})
},
}
lc := createListener()
listener, err := lc.Listen(
ctx,
"tcp",