Drop the call session if receivedCall returns an error [skip ci]

This commit is contained in:
Ali
2020-04-21 22:27:17 +04:00
parent 2b9347a3e5
commit 34deac51e3

View File

@@ -351,7 +351,15 @@ private final class CallSessionManagerContext {
let internalId = CallSessionInternalId()
let context = CallSessionContext(peerId: peerId, isOutgoing: false, state: .ringing(id: stableId, accessHash: accessHash, gAHash: gAHash, b: b))
self.contexts[internalId] = context
context.acknowledgeIncomingCallDisposable.set(self.network.request(Api.functions.phone.receivedCall(peer: .inputPhoneCall(id: stableId, accessHash: accessHash))).start())
let queue = self.queue
context.acknowledgeIncomingCallDisposable.set(self.network.request(Api.functions.phone.receivedCall(peer: .inputPhoneCall(id: stableId, accessHash: accessHash))).start(error: { [weak self] _ in
queue.async {
guard let strongSelf = self else {
return
}
strongSelf.drop(internalId: internalId, reason: .disconnect, debugLog: .single(nil))
}
}))
self.contextIdByStableId[stableId] = internalId
self.contextUpdated(internalId: internalId)
self.ringingStatesUpdated()