fix channel
This commit is contained in:
parent
67c78df581
commit
45c701e90f
@ -19,7 +19,6 @@ struct LayerPacket {
|
||||
|
||||
enum LayerPacketError: Error {
|
||||
case invalidLength
|
||||
case crcError
|
||||
case invaldPacketType
|
||||
}
|
||||
|
||||
|
||||
@ -457,7 +457,8 @@ class SDLContext: @unchecked Sendable {
|
||||
self.udpHole?.sendPacket(context: self, session: session, data: encodedPacket)
|
||||
|
||||
await self.flowTracer.inc(num: data.count, type: .p2p)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// 通过super_node进行转发
|
||||
self.udpHole?.forwardPacket(context: self, dst_mac: dstMac, data: encodedPacket)
|
||||
// 流量统计
|
||||
|
||||
@ -10,6 +10,7 @@ import NIOCore
|
||||
|
||||
// 网络类型探测器
|
||||
struct SDLNatProber {
|
||||
|
||||
// 定义nat类型
|
||||
enum NatType: UInt8, Encodable {
|
||||
case blocked = 0
|
||||
|
||||
@ -77,8 +77,10 @@ class SDLNoticeClient: ChannelInboundHandler, @unchecked Sendable {
|
||||
}
|
||||
|
||||
let remoteAddress = self.remoteAddress
|
||||
context.eventLoop.execute {
|
||||
let buffer = context.channel.allocator.buffer(bytes: data)
|
||||
let allocator = context.channel.allocator
|
||||
|
||||
context.eventLoop.execute { [allocator] in
|
||||
let buffer = allocator.buffer(bytes: data)
|
||||
let envelope = AddressedEnvelope<ByteBuffer>(remoteAddress: remoteAddress, data: buffer)
|
||||
context.writeAndFlush(self.wrapOutboundOut(envelope), promise: nil)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user