From d237e06dab5bf200e147d0bd2478b0257098fe5e Mon Sep 17 00:00:00 2001 From: rcollier Date: Sun, 30 Jun 2013 20:00:50 +0000 Subject: [PATCH] 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 --- source/org/jivesoftware/smack/keepalive/KeepAliveManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/org/jivesoftware/smack/keepalive/KeepAliveManager.java b/source/org/jivesoftware/smack/keepalive/KeepAliveManager.java index 99e1acfba..a3cb4475f 100644 --- a/source/org/jivesoftware/smack/keepalive/KeepAliveManager.java +++ b/source/org/jivesoftware/smack/keepalive/KeepAliveManager.java @@ -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