Skip to content

Commit f980180

Browse files
committed
Auto Reconnect time now maxes out at 128 seconds
As suggested by @mingdong & @lucaslafarga in PR #210, the Automatic reconnect timer could never reach the max of 120 because of the accidental != check, setting the check to < 128000 now means that the reconnect delay will max out at 128 seconds correctly.
1 parent 1cda7b7 commit f980180

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/MqttAsyncClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ public void reconnect() throws MqttException {
10641064
* Attempts to reconnect the client to the server.
10651065
* If successful it will make sure that there are no further
10661066
* reconnects scheduled. However if the connect fails, the delay will double
1067-
* up to 2 minutes and will re-schedule the reconnect for after the delay.
1067+
* up to 128 seconds and will re-schedule the reconnect for after the delay.
10681068
*
10691069
* Any thrown exceptions are logged but not acted upon as it is assumed that
10701070
* they are being thrown due to the server being offline and so reconnect
@@ -1087,7 +1087,7 @@ public void onSuccess(IMqttToken asyncActionToken) {
10871087
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
10881088
//@Trace 502=Automatic Reconnect failed, rescheduling: {0}
10891089
log.fine(CLASS_NAME, methodName, "502", new Object[]{asyncActionToken.getClient().getClientId()});
1090-
if(reconnectDelay != 120000){
1090+
if(reconnectDelay < 128000){
10911091
reconnectDelay = reconnectDelay * 2;
10921092
}
10931093
rescheduleReconnectCycle(reconnectDelay);

0 commit comments

Comments
 (0)