mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-26 12:37:58 +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);
|
||||
// Create the packet collector before sending the packet
|
||||
PacketCollector packetCollector = createPacketCollector(packetFilter);
|
||||
// Now we can send the packet as the collector has been created
|
||||
sendPacket(packet);
|
||||
try {
|
||||
// Now we can send the packet as the collector has been created
|
||||
sendPacket(packet);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
packetCollector.cancel();
|
||||
throw e;
|
||||
}
|
||||
return packetCollector;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue