Skip to content

Commit 3c3e02c

Browse files
author
tzihan
committed
Roll back the features of 443359, 443362, 443363, 443364
Roll back the following features : Reconnect after reconnect fail. Auto connect after connect fail. Reconnect after connection lost. Reconnect after network recovery Change-Id: I74ce5d564ea689deaf506a9562136f1627988e2f Signed-off-by: tzihan <zhtang@cn.ibm.com>
1 parent 0183376 commit 3c3e02c

1 file changed

Lines changed: 4 additions & 17 deletions

File tree

  • org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/org/eclipse/paho/android/service

org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/org/eclipse/paho/android/service/MqttConnection.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.eclipse.paho.client.mqttv3.MqttException;
2929
import org.eclipse.paho.client.mqttv3.MqttMessage;
3030
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
31-
import org.eclipse.paho.client.mqttv3.MqttSecurityException;
3231
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
3332

3433
import android.app.Service;
@@ -111,15 +110,15 @@ public void setClientHandle(String clientHandle) {
111110
}
112111

113112
//store connect ActivityToken for reconnect
114-
private String connectActivityToken = null;
113+
private String reconnectActivityToken = null;
115114

116115
// our client object - instantiated on connect
117116
private MqttAsyncClient myClient = null;
118117

119118
// our (parent) service object
120119
private MqttService service = null;
121120

122-
private volatile boolean disconnected = true;
121+
private volatile boolean disconnected = false;
123122
private boolean cleanSession = true;
124123

125124
// Indicate this connection is connecting or not.
@@ -184,9 +183,8 @@ public void setClientHandle(String clientHandle) {
184183
public void connect(MqttConnectOptions options, String invocationContext,
185184
String activityToken) {
186185

187-
final String internel_invocationContext = invocationContext;
188186
connectOptions = options;
189-
connectActivityToken = activityToken;
187+
reconnectActivityToken = activityToken;
190188

191189
if (options != null) {
192190
cleanSession = options.isCleanSession();
@@ -258,11 +256,6 @@ public void onFailure(IMqttToken asyncActionToken,
258256

259257
doAfterConnectFail(resultBundle);
260258

261-
// if connect fail ,try reconnect.
262-
if(service.isOnline()){
263-
connect(connectOptions, internel_invocationContext,connectActivityToken);
264-
}
265-
266259
}
267260
};
268261

@@ -795,8 +788,6 @@ public void onFailure(IMqttToken asyncActionToken,
795788
Log.getStackTraceString(why));
796789
}
797790
service.callbackToActivity(clientHandle, Status.OK, resultBundle);
798-
service.traceDebug(TAG,"Reconnect for connection lost");
799-
reconnect();
800791
// client has lost connection no need for wake lock
801792
releaseWakeLock();
802793
}
@@ -980,7 +971,7 @@ synchronized void reconnect() {
980971
final Bundle resultBundle = new Bundle();
981972
resultBundle.putString(
982973
MqttServiceConstants.CALLBACK_ACTIVITY_TOKEN,
983-
connectActivityToken);
974+
reconnectActivityToken);
984975
resultBundle.putString(
985976
MqttServiceConstants.CALLBACK_INVOCATION_CONTEXT, null);
986977
resultBundle.putString(MqttServiceConstants.CALLBACK_ACTION,
@@ -1011,10 +1002,6 @@ public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
10111002

10121003
doAfterConnectFail(resultBundle);
10131004

1014-
//reconnect fail , try reconnect . check network in reconnect function;
1015-
service.traceDebug(TAG,"Reconnect Fail,Reconnect!");
1016-
reconnect();
1017-
10181005
}
10191006
};
10201007

0 commit comments

Comments
 (0)