mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 16:22:06 +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:
parent
9f2446c78e
commit
d237e06dab
1 changed files with 2 additions and 2 deletions
|
@ -276,10 +276,10 @@ public class KeepAliveManager {
|
||||||
public void run() {
|
public void run() {
|
||||||
Ping ping = new Ping();
|
Ping ping = new Ping();
|
||||||
PacketFilter responseFilter = new PacketIDFilter(ping.getPacketID());
|
PacketFilter responseFilter = new PacketIDFilter(ping.getPacketID());
|
||||||
final PacketCollector response = connection.createPacketCollector(responseFilter);
|
final PacketCollector response = pingFailedListeners.isEmpty() ? null : connection.createPacketCollector(responseFilter);
|
||||||
connection.sendPacket(ping);
|
connection.sendPacket(ping);
|
||||||
|
|
||||||
if (!pingFailedListeners.isEmpty()) {
|
if (response != null) {
|
||||||
// Schedule a collector for the ping reply, notify listeners if none is received.
|
// Schedule a collector for the ping reply, notify listeners if none is received.
|
||||||
periodicPingExecutorService.schedule(new Runnable() {
|
periodicPingExecutorService.schedule(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue