1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-06-16 00:24:49 +02:00

Prevent PacketCollector leaking

in AbstractXMPPConnection.createPacketCollectorAndSend(IQ) in case there
is a NoResponseException.
This commit is contained in:
Florian Schmaus 2014-08-04 18:15:42 +02:00
parent 6caf2cbdb5
commit 70f1c22bb2

View file

@ -654,8 +654,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
PacketFilter packetFilter = new IQReplyFilter(packet, this); PacketFilter packetFilter = new IQReplyFilter(packet, this);
// Create the packet collector before sending the packet // Create the packet collector before sending the packet
PacketCollector packetCollector = createPacketCollector(packetFilter); PacketCollector packetCollector = createPacketCollector(packetFilter);
// Now we can send the packet as the collector has been created try {
sendPacket(packet); // Now we can send the packet as the collector has been created
sendPacket(packet);
}
catch (NotConnectedException e) {
packetCollector.cancel();
throw e;
}
return packetCollector; return packetCollector;
} }