From b0729d83a8761010331fe015af14be6325951a91 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 12 May 2021 10:12:59 +0200 Subject: [PATCH] [jingle] Do not call nextResult() in JingleUtil StanzaCollector.nextResult() will not cancel the related stanza collector potentially causing a resource leak. --- .../org/jivesoftware/smackx/jingle/JingleUtil.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleUtil.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleUtil.java index 6eb5911fe..000765ec9 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleUtil.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleUtil.java @@ -17,8 +17,10 @@ package org.jivesoftware.smackx.jingle; import org.jivesoftware.smack.SmackException; +import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; +import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.StanzaError; @@ -100,12 +102,12 @@ public class JingleUtil { JingleContent.Senders contentSenders, JingleContentDescription description, JingleContentTransport transport) - throws SmackException.NotConnectedException, InterruptedException { + throws SmackException.NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException { Jingle jingle = createSessionInitiate(recipient, sessionId, contentCreator, contentName, contentSenders, description, transport); - return connection.createStanzaCollectorAndSend(jingle).nextResult(); + return connection.sendIqRequestAndWaitForResponse(jingle); } public Jingle createSessionAccept(FullJid recipient, @@ -142,12 +144,12 @@ public class JingleUtil { JingleContent.Senders contentSenders, JingleContentDescription description, JingleContentTransport transport) - throws SmackException.NotConnectedException, InterruptedException { + throws SmackException.NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException { Jingle jingle = createSessionAccept(recipient, sessionId, contentCreator, contentName, contentSenders, description, transport); - return connection.createStanzaCollectorAndSend(jingle).nextResult(); + return connection.sendIqRequestAndWaitForResponse(jingle); } public Jingle createSessionTerminate(FullJid recipient, String sessionId, JingleReason reason) {