Fix call log sending

This commit is contained in:
Ali
2020-08-08 19:33:10 +04:00
parent 0562d606fc
commit 9df77b8d19
5 changed files with 26 additions and 3 deletions

View File

@@ -717,6 +717,18 @@ public final class OngoingCallContext {
}
}
private func withContextThenDeallocate(_ f: @escaping (OngoingCallThreadLocalContextProtocol) -> Void) {
self.queue.async {
if let contextRef = self.contextRef {
let context = contextRef.takeUnretainedValue()
f(context.context)
self.contextRef?.release()
self.contextRef = nil
}
}
}
public func beginTermination() {
self.withContext { context in
context.nativeBeginTermination()
@@ -727,7 +739,7 @@ public final class OngoingCallContext {
let account = self.account
let logPath = self.logPath
self.withContext { context in
self.withContextThenDeallocate { context in
context.nativeStop { debugLog, bytesSentWifi, bytesReceivedWifi, bytesSentMobile, bytesReceivedMobile in
debugLogValue.set(.single(debugLog))
let delta = NetworkUsageStatsConnectionsEntry(