From 876b1149d548e88ef0342e125c676971bcf2fae9 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 21 Apr 2020 22:59:54 +0200 Subject: [PATCH] avoid double termination after failed connection --- .../conversations/xmpp/jingle/JingleRtpConnection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java index f183f7ee9..797993aa5 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -958,7 +958,13 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web private void closeWebRTCSessionAfterFailedConnection() { this.webRTCWrapper.close(); - sendSessionTerminate(Reason.CONNECTIVITY_ERROR); + synchronized (this) { + if (TERMINATED.contains(state)) { + Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": no need to send session-terminate after failed connection. Other party already did"); + return; + } + sendSessionTerminate(Reason.CONNECTIVITY_ERROR); + } } public AppRTCAudioManager getAudioManager() {