PingManager min timeout of 2 mins & documentation question

In SMACK Version: 4.4.6 (4.4.6-4.4 2022-06-29)

I want to understand why does smack use a timeout which is MIN(2 minutes, connection_timeout) ?

Code snippet:

final long minimumTimeout = TimeUnit.MINUTES.toMillis(2);
final long connectionReplyTimeout = connection.getReplyTimeout();
final long timeout = connectionReplyTimeout > minimumTimeout ? connectionReplyTimeout : minimumTimeout;

Also in documentation for SetPingInterval it says:
“If the ping fails after 3 attempts waiting the connections reply timeout for an answer, then the ping failed listeners will be invoked.”
I did not find this to be true , used a pingInterval of 3 minutes and got pingFailed after 2 minutes instead of 6 minutes. [My connection timeout was 2 minutes]

Context: PingManager in Smack library

It’s not MIN, its MAX, isn’t it?

Smack ensures that, for PingManager, the smallest timeout is 2 minutes.

PingManager’s period pings are meant as backup guardian that monitors your connection. Smaller timeouts result in increased resource consumption and false positives.

If you know that there is an ongoing user action, then you may want to use smaller timeouts for those actions, to achieve a reasonable UX.

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.