fix udpHole
This commit is contained in:
parent
55701085e3
commit
dcbaffe70e
@ -172,7 +172,8 @@ actor SDLContextActor {
|
|||||||
quicClient.start()
|
quicClient.start()
|
||||||
|
|
||||||
defer {
|
defer {
|
||||||
quicClient.stop()
|
self.quicClient?.stop()
|
||||||
|
self.quicClient = nil
|
||||||
SDLLogger.log("[SDLContext] quicClient: stop")
|
SDLLogger.log("[SDLContext] quicClient: stop")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -67,15 +67,14 @@ final class SDLUDPHole: ChannelInboundHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --MARK: ChannelInboundHandler delegate
|
// --MARK: ChannelInboundHandler delegate
|
||||||
|
|
||||||
func channelRead(context: ChannelHandlerContext, data: NIOAny) {
|
func channelRead(context: ChannelHandlerContext, data: NIOAny) {
|
||||||
let envelope = unwrapInboundIn(data)
|
let envelope = unwrapInboundIn(data)
|
||||||
var buffer = envelope.data
|
var buffer = envelope.data
|
||||||
let remoteAddress = envelope.remoteAddress
|
let remoteAddress = envelope.remoteAddress
|
||||||
|
|
||||||
if let rawBytes = buffer.getBytes(at: buffer.readerIndex, length: buffer.readableBytes) {
|
let byteCount = buffer.readableBytes - buffer.readerIndex
|
||||||
SDLLogger.log("[SDLUDPHole] get raw bytes: \(rawBytes.count), from: \(remoteAddress)", for: .debug)
|
SDLLogger.log("[SDLUDPHole] get raw bytes: \(byteCount), from: \(remoteAddress)", for: .debug)
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if let message = try SDLHoleMessage.decode(buffer: &buffer) {
|
if let message = try SDLHoleMessage.decode(buffer: &buffer) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user