Compare commits

..

No commits in common. "main" and "1.1.7" have entirely different histories.
main ... 1.1.7

2 changed files with 4 additions and 5 deletions

View File

@ -79,7 +79,7 @@ public class SDLContext: @unchecked Sendable {
private var flowTracer = SDLFlowTracerActor() private var flowTracer = SDLFlowTracerActor()
private var flowTracerCancel: AnyCancellable? private var flowTracerCancel: AnyCancellable?
public init(provider: NEPacketTunnelProvider, config: SDLConfiguration, rsaCipher: RSACipher, aesCipher: AESCipher) { public init(provider: NEPacketTunnelProvider, config: SDLConfiguration, rsaCipher: RSACipher, aesCipher: AESCipher) throws {
self.config = config self.config = config
self.rsaCipher = rsaCipher self.rsaCipher = rsaCipher
self.aesCipher = aesCipher self.aesCipher = aesCipher

View File

@ -8,15 +8,14 @@
import Foundation import Foundation
// qps // qps
class SDLQPSCounter: @unchecked Sendable { class SDLQPSCounter {
private var count = 0 private var count = 0
private let timer: DispatchSourceTimer private let timer: DispatchSourceTimer
private let label: String private let label: String
private let queue = DispatchQueue(label: "com.punchnet.qps")
init(label: String) { init(label: String) {
self.label = label self.label = label
timer = DispatchSource.makeTimerSource(queue: queue) timer = DispatchSource.makeTimerSource(queue: DispatchQueue(label: "com.yourapp.qps"))
timer.schedule(deadline: .now(), repeating: .seconds(1), leeway: .milliseconds(100)) timer.schedule(deadline: .now(), repeating: .seconds(1), leeway: .milliseconds(100))
timer.setEventHandler { [weak self] in timer.setEventHandler { [weak self] in
guard let self = self else { return } guard let self = self else { return }
@ -27,7 +26,7 @@ class SDLQPSCounter: @unchecked Sendable {
} }
func increment(num: Int = 1) { func increment(num: Int = 1) {
queue.async { DispatchQueue(label: "com.yourapp.qps").async {
self.count += num self.count += num
} }
} }