fix udpHole

This commit is contained in:
anlicheng 2026-04-15 15:49:48 +08:00
parent f8a3e9e028
commit f06a97ff50

View File

@ -38,19 +38,6 @@ final class SDLUDPHole: ChannelInboundHandler {
}
func start() throws -> SocketAddress {
switch self.state {
case .ready:
guard let channel = self.channel else {
preconditionFailure("SDLUDPHole is ready but channel is nil")
}
precondition(channel.localAddress != nil, "UDP channel has no localAddress after bind")
return channel.localAddress!
case .stopping, .stopped:
preconditionFailure("SDLUDPHole cannot be restarted after stop")
case .idle:
break
}
let bootstrap = DatagramBootstrap(group: group)
.channelOption(ChannelOptions.socketOption(.so_reuseaddr), value: 1)
.channelInitializer { channel in