mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-03 18:52:15 +08:00
feat: listen config
This commit is contained in:
parent
708cfe2ee5
commit
076205a290
@ -54,7 +54,16 @@ func Start[T any](ctx context.Context, discovery *config.Discovery, prometheusCo
|
|||||||
log.CInfo(ctx, "RPC server is initializing", "rpcRegisterName", rpcRegisterName, "rpcPort", rpcPort,
|
log.CInfo(ctx, "RPC server is initializing", "rpcRegisterName", rpcRegisterName, "rpcPort", rpcPort,
|
||||||
"prometheusPorts", prometheusConfig.Ports)
|
"prometheusPorts", prometheusConfig.Ports)
|
||||||
rpcTcpAddr := net.JoinHostPort(network.GetListenIP(listenIP), strconv.Itoa(rpcPort))
|
rpcTcpAddr := net.JoinHostPort(network.GetListenIP(listenIP), strconv.Itoa(rpcPort))
|
||||||
listener, err := net.Listen(
|
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
listener, err := lc.Listen(
|
||||||
|
ctx,
|
||||||
"tcp",
|
"tcp",
|
||||||
rpcTcpAddr,
|
rpcTcpAddr,
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user