fix
This commit is contained in:
parent
9a76b61ff0
commit
3ce4e05613
@ -134,9 +134,7 @@ public class SDLContext: @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try await group.waitForAll()
|
group.addTask {
|
||||||
}
|
|
||||||
|
|
||||||
// 启动网络监控
|
// 启动网络监控
|
||||||
self.monitorCancel = self.monitor.eventFlow.sink { event in
|
self.monitorCancel = self.monitor.eventFlow.sink { event in
|
||||||
switch event {
|
switch event {
|
||||||
@ -153,6 +151,10 @@ public class SDLContext: @unchecked Sendable {
|
|||||||
self.monitor.start()
|
self.monitor.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try await group.waitForAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public func stop() async {
|
public func stop() async {
|
||||||
self.superClient = nil
|
self.superClient = nil
|
||||||
self.udpHole = nil
|
self.udpHole = nil
|
||||||
@ -376,18 +378,18 @@ public class SDLContext: @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 流量统计
|
// 流量统计
|
||||||
public func flowReportTask() {
|
// public func flowReportTask() {
|
||||||
Task {
|
// Task {
|
||||||
// 每分钟汇报一次
|
// // 每分钟汇报一次
|
||||||
self.flowTracerCancel = Timer.publish(every: 60.0, on: .main, in: .common).autoconnect()
|
// self.flowTracerCancel = Timer.publish(every: 60.0, on: .main, in: .common).autoconnect()
|
||||||
.sink { _ in
|
// .sink { _ in
|
||||||
Task {
|
// Task {
|
||||||
let (forwardNum, p2pNum, inboundNum) = await self.flowTracer.reset()
|
// let (forwardNum, p2pNum, inboundNum) = await self.flowTracer.reset()
|
||||||
await self.superClient?.flowReport(forwardNum: forwardNum, p2pNum: p2pNum, inboundNum: inboundNum)
|
// await self.superClient?.flowReport(forwardNum: forwardNum, p2pNum: p2pNum, inboundNum: inboundNum)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 网络改变时需要重新配置网络信息
|
// 网络改变时需要重新配置网络信息
|
||||||
private func didNetworkConfigChanged(devAddr: SDLDevAddr, dnsServers: [String]? = nil) async {
|
private func didNetworkConfigChanged(devAddr: SDLDevAddr, dnsServers: [String]? = nil) async {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user