1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-02 06:45:59 +01:00

SMACK-441 Create packet collector only when necessary

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_1@13703 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2013-06-30 20:00:50 +00:00
parent 9f2446c78e
commit d237e06dab

View file

@ -276,10 +276,10 @@ public class KeepAliveManager {
public void run() {
Ping ping = new Ping();
PacketFilter responseFilter = new PacketIDFilter(ping.getPacketID());
final PacketCollector response = connection.createPacketCollector(responseFilter);
final PacketCollector response = pingFailedListeners.isEmpty() ? null : connection.createPacketCollector(responseFilter);
connection.sendPacket(ping);
if (!pingFailedListeners.isEmpty()) {
if (response != null) {
// Schedule a collector for the ping reply, notify listeners if none is received.
periodicPingExecutorService.schedule(new Runnable() {
@Override