From 1853242c6682c863d5524be0a1ee74c2c15e519e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 7 Jun 2020 14:59:55 +0200 Subject: [PATCH] do not throw when finishing jingle ft twice. fixes #3765 the state machine in jingle file transfer does not prevent that the connection is being finished twice --- .../conversations/xmpp/jingle/JingleConnectionManager.java | 4 ++++ .../siacs/conversations/xmpp/jingle/JingleRtpConnection.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java index 4a1f7148f..34b6ac9ab 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -447,6 +447,10 @@ public class JingleConnectionManager extends AbstractConnectionManager { } void finishConnection(final AbstractJingleConnection connection) { + this.connections.remove(connection.getId()); + } + + void finishConnectionOrThrow(final AbstractJingleConnection connection) { final AbstractJingleConnection.Id id = connection.getId(); if (this.connections.remove(id) == null) { throw new IllegalStateException(String.format("Unable to finish connection with id=%s", id.toString())); 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 8ff496835..835560aa1 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -1189,7 +1189,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web if (isTerminated()) { this.cancelRingingTimeout(); this.webRTCWrapper.verifyClosed(); - this.jingleConnectionManager.finishConnection(this); + this.jingleConnectionManager.finishConnectionOrThrow(this); } else { throw new IllegalStateException(String.format("Unable to call finish from %s", this.state)); }