Procházet zdrojové kódy

调式im重连机制

SpringBoots před 8 roky
rodič
revize
5377f750d3

+ 7 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/xmpp/XReconnectionManager.java

@@ -88,8 +88,13 @@ public class XReconnectionManager extends AbstractConnectionListener {
 			// Since there is no thread running, creates a new one to attempt
 			// the reconnection.
 			// avoid to run duplicated reconnectionThread -- fd: 16/09/2010
-			if (mReconnectionThread != null && mReconnectionThread.isAlive())
+			if (mReconnectionThread != null && mReconnectionThread.isAlive()){
+				LogUtil.d("ReconnectionThread","ReconnectionThread 存在线程:"+((XMPPTCPConnection) mConnection).getDirectUser());
 				return;
+			}else{
+				LogUtil.d("ReconnectionThread","ReconnectionThread 新线程:"+((XMPPTCPConnection) mConnection).getDirectUser());
+			}
+				
 			mReconnectionThread = new Thread() {
 
 				private int mRandomBase = new Random().nextInt(11) + 5; // between 5 and 15 seconds
@@ -350,6 +355,7 @@ public class XReconnectionManager extends AbstractConnectionListener {
 
 	@Override
 	public void connectionClosedOnError(Exception e) {
+		LogUtil.d("reconnect","<<connectionClosedOnError>> mConnection:"+((XMPPTCPConnection) mConnection).getDirectUser());
 		doReconnecting = true;
 		if (e instanceof StreamErrorException) {// 有人重复登陆
 			StreamErrorException xmppEx = (StreamErrorException) e;