瀏覽代碼

1.尝试优化代理不断onclose的问题

huangxiaodong 1 年之前
父節點
當前提交
6ab97c9716
共有 1 個文件被更改,包括 15 次插入7 次删除
  1. 15 7
      创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm

+ 15 - 7
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm

@@ -482,13 +482,21 @@ ComontAlretViewControllerDelegate>
     
     if(self.commandChannelManager){
         
-        HLog(@"WebSocket 链接时已经存在");
-        [self.commandChannelManager rc_close];
-        
-        self.commandChannelManager = nil;
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            [self opencommandChannelManagerrc_openURL];
-        });
+        if([self.commandChannelManager rc_socketStatus] == RCSocketCloudPhoneStatusConnected
+           ||[self.commandChannelManager rc_socketStatus] == RCSocketCloudPhoneStatusReceived){
+            //链接中不处理
+            HLog(@"WebSocket 链接时已经存在并且链接中");
+        }
+        else{
+            HLog(@"WebSocket 链接时已经存在并且链接失效");
+            
+            [self.commandChannelManager rc_close];
+            
+            self.commandChannelManager = nil;
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                [self opencommandChannelManagerrc_openURL];
+            });
+        }
         
         return;
     }