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 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.rsaCipher = rsaCipher
self.aesCipher = aesCipher

View File

@ -8,15 +8,14 @@
import Foundation
// qps
class SDLQPSCounter: @unchecked Sendable {
class SDLQPSCounter {
private var count = 0
private let timer: DispatchSourceTimer
private let label: String
private let queue = DispatchQueue(label: "com.punchnet.qps")
init(label: String) {
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.setEventHandler { [weak self] in
guard let self = self else { return }
@ -27,7 +26,7 @@ class SDLQPSCounter: @unchecked Sendable {
}
func increment(num: Int = 1) {
queue.async {
DispatchQueue(label: "com.yourapp.qps").async {
self.count += num
}
}