Browse Source

## [1.1.49] version 67 - 2020-08-17
### Changed
- 30次重连后重启APP

allen 3 years ago
parent
commit
a131996273

+ 2 - 2
build.gradle

@@ -47,12 +47,12 @@ buildscript {
     /**
     /**
      * APP版本码
      * APP版本码
      */
      */
-    ext.app_version_code = 66
+    ext.app_version_code = 67
 
 
     /**
     /**
      * APP版本号
      * APP版本号
      */
      */
-    ext.app_version = "1.1.48"
+    ext.app_version = "1.1.49"
 
 
     /**
     /**
      * 项目依赖库
      * 项目依赖库

+ 2 - 0
home/src/main/code/com/wdkl/ncs/android/component/home/service/WdKeepAliveService.kt

@@ -306,6 +306,8 @@ class WdKeepAliveService : AbsWorkService() {
                     } else {
                     } else {
                         TcpClient.getInstance().doConnect(iTcpCallBack)
                         TcpClient.getInstance().doConnect(iTcpCallBack)
                     }
                     }
+                } else {
+                    AppUtils.restartApp()
                 }
                 }
             } else {
             } else {
                 TcpClient.getInstance().sendMsg("0")
                 TcpClient.getInstance().sendMsg("0")

+ 4 - 4
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/TcpClient.java

@@ -47,8 +47,7 @@ public class TcpClient {
     //初始化Netty Tcp Client 并连接
     //初始化Netty Tcp Client 并连接
     public synchronized void init(String serverIP, Integer serverPort, Integer heartBeatSeconds, ITcpCallBack iTcpCallBack) {
     public synchronized void init(String serverIP, Integer serverPort, Integer heartBeatSeconds, ITcpCallBack iTcpCallBack) {
         if (bootstrap!=null){
         if (bootstrap!=null){
-            doConnect(iTcpCallBack);
-            return;
+            bootstrap = null;
         }
         }
 
 
         final Integer hbSeconds = heartBeatSeconds;
         final Integer hbSeconds = heartBeatSeconds;
@@ -99,6 +98,7 @@ public class TcpClient {
                 } else {
                 } else {
                     //连接失败时的处理
                     //连接失败时的处理
                     System.out.println("TcpClient connect retry : " + retryTimes);
                     System.out.println("TcpClient connect retry : " + retryTimes);
+
                     channelFuture.channel().eventLoop().schedule(new Runnable() {
                     channelFuture.channel().eventLoop().schedule(new Runnable() {
                         @Override
                         @Override
                         public void run() {
                         public void run() {
@@ -110,12 +110,12 @@ public class TcpClient {
                                     public void run() {
                                     public void run() {
                                         retryTimes = 0;
                                         retryTimes = 0;
                                         System.out.println("TcpClient 1分钟后 重试连接");
                                         System.out.println("TcpClient 1分钟后 重试连接");
-                                        doConnect(iTcpCallBack);
+                                        init(Constants.Companion.getTcpServer(),Constants.Companion.getTcpPort(),Constants.Companion.getHeartBeat(),iTcpCallBack);
                                     }
                                     }
                                 },60*10, TimeUnit.SECONDS);
                                 },60*10, TimeUnit.SECONDS);
                             } else {
                             } else {
                                 retryTimes++;
                                 retryTimes++;
-                                doConnect(iTcpCallBack);
+                                init(Constants.Companion.getTcpServer(),Constants.Companion.getTcpPort(),Constants.Companion.getHeartBeat(),iTcpCallBack);
                             }
                             }
                         }
                         }
                     }, retrySeconds, TimeUnit.SECONDS);
                     }, retrySeconds, TimeUnit.SECONDS);

+ 7 - 0
readme.md

@@ -26,6 +26,13 @@
 
 
 ---
 ---
 
 
+## [1.1.49] version 67 - 2020-08-17
+### Changed
+- 30次重连后重启APP
+
+---
+
+
 ## [1.1.48] version 66 - 2020-08-17
 ## [1.1.48] version 66 - 2020-08-17
 ### Changed
 ### Changed
 - 回退
 - 回退