fix udpHole
This commit is contained in:
parent
f8a3e9e028
commit
f06a97ff50
@ -38,19 +38,6 @@ final class SDLUDPHole: ChannelInboundHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func start() throws -> SocketAddress {
|
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)
|
let bootstrap = DatagramBootstrap(group: group)
|
||||||
.channelOption(ChannelOptions.socketOption(.so_reuseaddr), value: 1)
|
.channelOption(ChannelOptions.socketOption(.so_reuseaddr), value: 1)
|
||||||
.channelInitializer { channel in
|
.channelInitializer { channel in
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user