Shutdown: Don't hang up ringing incoming calls

Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
This commit is contained in:
Scott Nonnenberg
2025-04-26 06:23:44 +10:00
committed by GitHub
parent eb10d6f42f
commit 9a6a9f0bf6
4 changed files with 36 additions and 9 deletions
+4 -3
View File
@@ -758,9 +758,10 @@ export async function startApp(): Promise<void> {
flushMessageCounter();
// Hangup active calls
window.Signal.Services.calling.hangupAllCalls(
'background/shutdown: shutdown requested'
);
window.Signal.Services.calling.hangupAllCalls({
excludeRinging: true,
reason: 'background/shutdown: shutdown requested',
});
const attachmentDownloadStopPromise = AttachmentDownloadManager.stop();
const attachmentBackupStopPromise = AttachmentBackupManager.stop();
+27 -4
View File
@@ -2162,7 +2162,15 @@ export class CallingClass {
);
}
hangup(conversationId: string, reason: string): void {
hangup({
conversationId,
excludeRinging,
reason,
}: {
conversationId: string;
excludeRinging?: boolean;
reason: string;
}): void {
const logId = getLogId({
source: 'CallingClass.hangup',
conversationId,
@@ -2191,7 +2199,16 @@ export class CallingClass {
this.videoRenderer.disable();
call.setOutgoingAudioMuted(true);
call.setOutgoingVideoMuted(true);
RingRTC.hangup(call.callId);
if (
excludeRinging &&
call.state === CallState.Ringing &&
call.isIncoming
) {
log.info(`${logId}: Refusing to hang up call that is still ringing`);
} else {
RingRTC.hangup(call.callId);
}
} else if (call instanceof GroupCall) {
// This ensures that we turn off our devices.
call.setOutgoingAudioMuted(true);
@@ -2205,10 +2222,16 @@ export class CallingClass {
log.info(`${logId}: Done.`);
}
hangupAllCalls(reason: string): void {
hangupAllCalls({
excludeRinging,
reason,
}: {
excludeRinging: boolean;
reason: string;
}): void {
const conversationIds = Object.keys(this.#callsLookup);
for (const conversationId of conversationIds) {
this.hangup(conversationId, reason);
this.hangup({ conversationId, excludeRinging, reason });
}
}
+1 -1
View File
@@ -1653,7 +1653,7 @@ function hangUpActiveCall(
const { conversationId } = activeCall;
calling.hangup(conversationId, reason);
calling.hangup({ conversationId, reason });
dispatch({
type: HANG_UP,
+4 -1
View File
@@ -2700,7 +2700,10 @@ export function cancelConversationVerification(
activeCall.conversationId === conversationId &&
activeCall.callMode === CallMode.Direct
) {
calling.hangup(conversationId, 'canceled conversation verification');
calling.hangup({
conversationId,
reason: 'canceled conversation verification',
});
}
conversationJobQueue.resolveVerificationWaiter(conversationId);
});