1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-23 04:22:05 +01:00

Add PingManager.pingMyServer(boolean,long)

This commit is contained in:
Florian Schmaus 2014-09-30 13:09:09 +02:00
parent a942863ffe
commit 414db1ebbe

View file

@ -245,9 +245,25 @@ public class PingManager extends Manager {
* @throws NotConnectedException * @throws NotConnectedException
*/ */
public boolean pingMyServer(boolean notifyListeners) throws NotConnectedException { public boolean pingMyServer(boolean notifyListeners) throws NotConnectedException {
return pingMyServer(notifyListeners, connection().getPacketReplyTimeout());
}
/**
* Pings the server. This method will return true if the server is reachable. It
* is the equivalent of calling <code>ping</code> with the XMPP domain.
* <p>
* Unlike the {@link #ping(String)} case, this method will return true even if
* {@link #isPingSupported(String)} is false.
*
* @param notifyListeners Notify the PingFailedListener in case of error if true
* @param pingTimeout The time to wait for a reply in milliseconds
* @return true if the user's server could be pinged.
* @throws NotConnectedException
*/
public boolean pingMyServer(boolean notifyListeners, long pingTimeout) throws NotConnectedException {
boolean res; boolean res;
try { try {
res = ping(connection().getServiceName()); res = ping(connection().getServiceName(), pingTimeout);
} }
catch (NoResponseException e) { catch (NoResponseException e) {
res = false; res = false;