This commit is contained in:
anlicheng 2025-08-02 23:56:40 +08:00
parent 3e96169690
commit 3ab5580dcb
2 changed files with 4 additions and 3 deletions

View File

@ -120,7 +120,7 @@ public class SDLContext: @unchecked Sendable {
do { do {
try await self.startSuperClient() try await self.startSuperClient()
} catch let err { } catch let err {
NSLog("SuperClient get error: \(err)") NSLog("[SDLContext] SuperClient get error: \(err), will restart")
await self.arpServer.clear() await self.arpServer.clear()
try? await Task.sleep(for: .seconds(2)) try? await Task.sleep(for: .seconds(2))
} }

View File

@ -9,8 +9,6 @@ import Foundation
import NIOCore import NIOCore
import NIOPosix import NIOPosix
// --MARK: SuperNode // --MARK: SuperNode
actor SDLSuperClient { actor SDLSuperClient {
private let group = MultiThreadedEventLoopGroup(numberOfThreads: 1) private let group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
@ -82,6 +80,7 @@ actor SDLSuperClient {
} }
} }
} }
NSLog("[SDLSuperClient] inbound closed")
} }
group.addTask { group.addTask {
@ -92,6 +91,7 @@ actor SDLSuperClient {
buffer.writeBytes(message.data) buffer.writeBytes(message.data)
try await outbound.write(buffer) try await outbound.write(buffer)
} }
NSLog("[SDLSuperClient] outbound closed")
} }
// --MARK: // --MARK:
@ -100,6 +100,7 @@ actor SDLSuperClient {
await self.ping() await self.ping()
try? await Task.sleep(nanoseconds: 5 * 1_000_000_000) try? await Task.sleep(nanoseconds: 5 * 1_000_000_000)
} }
NSLog("[SDLSuperClient] heartbeat cancelled")
} }
try await group.waitForAll() try await group.waitForAll()