1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

[jingle] Do not call nextResult() in JingleUtil

StanzaCollector.nextResult() will not cancel the related stanza
collector potentially causing a resource leak.
This commit is contained in:
Florian Schmaus 2021-05-12 10:12:59 +02:00
parent aab48570c9
commit b0729d83a8

View file

@ -17,8 +17,10 @@
package org.jivesoftware.smackx.jingle; package org.jivesoftware.smackx.jingle;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
@ -100,12 +102,12 @@ public class JingleUtil {
JingleContent.Senders contentSenders, JingleContent.Senders contentSenders,
JingleContentDescription description, JingleContentDescription description,
JingleContentTransport transport) JingleContentTransport transport)
throws SmackException.NotConnectedException, InterruptedException { throws SmackException.NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
Jingle jingle = createSessionInitiate(recipient, sessionId, contentCreator, contentName, contentSenders, Jingle jingle = createSessionInitiate(recipient, sessionId, contentCreator, contentName, contentSenders,
description, transport); description, transport);
return connection.createStanzaCollectorAndSend(jingle).nextResult(); return connection.sendIqRequestAndWaitForResponse(jingle);
} }
public Jingle createSessionAccept(FullJid recipient, public Jingle createSessionAccept(FullJid recipient,
@ -142,12 +144,12 @@ public class JingleUtil {
JingleContent.Senders contentSenders, JingleContent.Senders contentSenders,
JingleContentDescription description, JingleContentDescription description,
JingleContentTransport transport) JingleContentTransport transport)
throws SmackException.NotConnectedException, InterruptedException { throws SmackException.NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
Jingle jingle = createSessionAccept(recipient, sessionId, contentCreator, contentName, contentSenders, Jingle jingle = createSessionAccept(recipient, sessionId, contentCreator, contentName, contentSenders,
description, transport); description, transport);
return connection.createStanzaCollectorAndSend(jingle).nextResult(); return connection.sendIqRequestAndWaitForResponse(jingle);
} }
public Jingle createSessionTerminate(FullJid recipient, String sessionId, JingleReason reason) { public Jingle createSessionTerminate(FullJid recipient, String sessionId, JingleReason reason) {