Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--protocols/bundles/org.jivesoftware.smack/src/org/jivesoftware/smack/keepalive/KeepAliveManager.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/protocols/bundles/org.jivesoftware.smack/src/org/jivesoftware/smack/keepalive/KeepAliveManager.java b/protocols/bundles/org.jivesoftware.smack/src/org/jivesoftware/smack/keepalive/KeepAliveManager.java
index dea49b80f..5246896fc 100644
--- a/protocols/bundles/org.jivesoftware.smack/src/org/jivesoftware/smack/keepalive/KeepAliveManager.java
+++ b/protocols/bundles/org.jivesoftware.smack/src/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

Back to the top