Authored by 钱兢安

socket设置 review by 盖建秋

... ... @@ -151,7 +151,6 @@
[self initUI];
[self loadChannelData];
[self setUpPush];
_socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)];
_currentRetryCount = 0;
DLog(@"=====%@",[_livePush getSDKVersion]);
}
... ... @@ -442,6 +441,12 @@
- (void)connectSocket {
if (_socket) {
[_socket disconnect];
_socket = nil;
}
_socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)];
[_socket connectToHost:_socketService.socketLiveHost onPort:_socketService.socketLivePort error:nil];
}
... ... @@ -477,7 +482,7 @@
dispatch_async(dispatch_get_main_queue(), ^{
if (tag == 1) {//登录成功了之后才继续后面的。。。。
[self socketSendEndNotify];
_socketTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(socketSendEndNotify) userInfo:nil repeats:YES];
_socketTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(socketSendEndNotify) userInfo:nil repeats:YES];
}
});
}
... ... @@ -495,9 +500,11 @@
DLog(@"通知结束成功");
[self toastTip:@"通知结束成功"];
[sock disconnect];
_socket = nil;
[self loadChannelData];//防止主播再次进入同一间房间。
_inPushing = NO;
[_socketTimer invalidate];
_socketTimer = nil;
[self stopRtmp];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kPushging];
// [self.socketService endPaly:_timeLabel.text];
... ...