add log
This commit is contained in:
parent
3e96169690
commit
a292bec2c4
@ -120,7 +120,7 @@ public class SDLContext: @unchecked Sendable {
|
||||
do {
|
||||
try await self.startSuperClient()
|
||||
} catch let err {
|
||||
NSLog("SuperClient get error: \(err)")
|
||||
NSLog("[SDLContext] SuperClient get error: \(err), will restart")
|
||||
await self.arpServer.clear()
|
||||
try? await Task.sleep(for: .seconds(2))
|
||||
}
|
||||
|
||||
@ -9,8 +9,6 @@ import Foundation
|
||||
import NIOCore
|
||||
import NIOPosix
|
||||
|
||||
|
||||
|
||||
// --MARK: 和SuperNode的客户端
|
||||
actor SDLSuperClient {
|
||||
private let group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
|
||||
@ -82,6 +80,7 @@ actor SDLSuperClient {
|
||||
}
|
||||
}
|
||||
}
|
||||
NSLog("[SDLSuperClient] inbound closed")
|
||||
}
|
||||
|
||||
group.addTask {
|
||||
@ -92,6 +91,7 @@ actor SDLSuperClient {
|
||||
buffer.writeBytes(message.data)
|
||||
try await outbound.write(buffer)
|
||||
}
|
||||
NSLog("[SDLSuperClient] outbound closed")
|
||||
}
|
||||
|
||||
// --MARK: 心跳机制
|
||||
@ -100,6 +100,7 @@ actor SDLSuperClient {
|
||||
await self.ping()
|
||||
try? await Task.sleep(nanoseconds: 5 * 1_000_000_000)
|
||||
}
|
||||
NSLog("[SDLSuperClient] heartbeat cancelled")
|
||||
}
|
||||
|
||||
try await group.waitForAll()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user