Browse Source

修复一个bug

luoguangyi 3 years ago
parent
commit
6a2458d610

+ 2 - 8
src/main/java/com/persagy/iottransfer/server/IotServerReceiveMessageThread.java

@@ -33,10 +33,7 @@ public class IotServerReceiveMessageThread implements Runnable {
             while (true) {
                 try {
                     tcpControl = IotServer.tcpControlServerManager.takeRece();
-                    if (tcpControl != null) {
-                        if (tcpControl.address == null) {
-                            break;
-                        }
+                    if (tcpControl != null && tcpControl.address == null) {
                         addProject(tcpControl, "tcpControl");
                         log.info("收到iot-project 控制消息:{}", tcpControl);
                         kafkaProducer.sendFromedge2control(tcpControl);
@@ -50,10 +47,7 @@ public class IotServerReceiveMessageThread implements Runnable {
             while (true) {
                 try {
                     tcpCollect = IotServer.tcpCollectServerManager.takeRece();
-                    if (tcpCollect != null) {
-                        if (tcpCollect.address == null) {
-                            break;
-                        }
+                    if (tcpCollect != null && tcpCollect.address == null) {
                         addProject(tcpCollect, "tcpCollect");
                         log.info("收到iot-project 采集消息:{}", tcpCollect);
                         kafkaProducer.sendFromedge2collect(tcpCollect);