1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-12 05:51:08 +01:00

Add and use AbstractConnectionClosedListener

This commit is contained in:
Florian Schmaus 2015-01-07 19:56:44 +01:00
parent b23c3226d2
commit 82eb9b18dd
7 changed files with 56 additions and 47 deletions

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2012-2014 Florian Schmaus
* Copyright 2012-2015 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.AbstractConnectionClosedListener;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
@ -135,17 +135,13 @@ public class PingManager extends Manager {
connection().sendPacket(ping.getPong());
}
}, PING_PACKET_FILTER);
connection.addConnectionListener(new AbstractConnectionListener() {
connection.addConnectionListener(new AbstractConnectionClosedListener() {
@Override
public void authenticated(XMPPConnection connection) {
maybeSchedulePingServerTask();
}
@Override
public void connectionClosed() {
maybeStopPingServerTask();
}
@Override
public void connectionClosedOnError(Exception arg0) {
public void connectionTerminated() {
maybeStopPingServerTask();
}
});