mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 22:32:06 +01:00
Prevent PacketCollector leaking
in AbstractXMPPConnection.createPacketCollectorAndSend(IQ) in case there is a NoResponseException.
This commit is contained in:
parent
6caf2cbdb5
commit
70f1c22bb2
1 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue