1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 10:37:59 +01:00

Prevent GC of connection within pingServerIfNecessary()

This commit is contained in:
Florian Schmaus 2016-09-05 14:56:40 +02:00
parent 9a16f68433
commit 810e7c8b78

View file

@ -377,7 +377,10 @@ public final class PingManager extends Manager {
res = pingMyServer(false);
}
catch (InterruptedException | SmackException e) {
LOGGER.log(Level.WARNING, "Exception while pinging server", e);
// Note that we log the connection here, so that it is not GC'ed between the call to isAuthenticated
// a few lines above and the usage of the connection within pingMyServer(). In order to prevent:
// https://community.igniterealtime.org/thread/59369
LOGGER.log(Level.WARNING, "Exception while pinging server of " + connection, e);
res = false;
}
// stop when we receive a pong back