Skip to content

Commit

Permalink
Remove ping to server (close #304)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniele Ricci <[email protected]>
  • Loading branch information
daniele-athome committed Feb 22, 2015
1 parent b6c6a9a commit abbd3cb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.jivesoftware.smackx.iqlast.packet.LastActivity;
import org.jivesoftware.smackx.iqversion.VersionManager;
import org.jivesoftware.smackx.ping.PingFailedListener;
import org.jivesoftware.smackx.ping.PingManager;
import org.jivesoftware.smackx.ping.packet.Ping;
import org.jivesoftware.smackx.receipts.DeliveryReceipt;
import org.jivesoftware.smackx.receipts.DeliveryReceiptRequest;
import org.spongycastle.openpgp.PGPException;
Expand Down Expand Up @@ -142,9 +139,6 @@ public class MessageCenterService extends Service implements ConnectionHelperLis
SmackConfiguration.DEBUG = BuildConfig.DEBUG;
}

/** Ping to server interval in seconds. */
private static final int PING_INTERVAL = 120;

public static final String ACTION_PACKET = "org.kontalk.action.PACKET";
public static final String ACTION_HOLD = "org.kontalk.action.HOLD";
public static final String ACTION_RELEASE = "org.kontalk.action.RELEASE";
Expand Down Expand Up @@ -943,29 +937,12 @@ public synchronized void created(XMPPConnection connection) {
Log.v(TAG, "connection created.");
mConnection = (KontalkConnection) connection;

// setup ping manager
final PingManager pingMgr = PingManager.getInstanceFor(connection);
pingMgr.setPingInterval(PING_INTERVAL);
pingMgr.registerPingFailedListener(new PingFailedListener() {
@Override
public void pingFailed() {
Log.v(TAG, "ping failed, restarting message center");
// unregister this listener
pingMgr.unregisterPingFailedListener(this);
// restart the message center
restart(getApplicationContext());
}
});

// setup version manager
final VersionManager verMgr = VersionManager.getInstanceFor(connection);
verMgr.setVersion(getString(R.string.app_name), SystemUtils.getVersionName(this));

PacketFilter filter;

filter = new PacketTypeFilter(Ping.class);
connection.addAsyncPacketListener(new PingListener(this), filter);

filter = new PacketTypeFilter(Presence.class);
connection.addAsyncPacketListener(new PresenceListener(this), filter);

Expand Down
39 changes: 0 additions & 39 deletions app/src/main/java/org/kontalk/service/msgcenter/PingListener.java

This file was deleted.

0 comments on commit abbd3cb

Please sign in to comment.