Skip to content

Commit 97e14ae

Browse files
Merge pull request #288 from TakayukiHoshi1984/bugfix_restart_server_by_ssl_switch
不具合修正: SSLスイッチでサーバーが停止後、再起動しないことがある。
2 parents dd0797b + 3b71ec5 commit 97e14ae

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/classes/GHSettingViewModel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,6 @@ typedef NS_ENUM (NSInteger, SecurityCellType) {
5555
- (void)didSelectedRow:(NSIndexPath *)indexPath;
5656
- (BOOL)switchState:(SecurityCellType)type;
5757

58+
-(void)restartManager;
59+
5860
@end

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/classes/GHSettingViewModel.m

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,25 @@ - (void)updateSwitch:(SecurityCellType)type switchState:(BOOL)isOn
160160
break;
161161
case SecurityCellTypeSSL:
162162
[DConnectManager sharedManager].settings.useSSL = isOn;
163-
[[DConnectManager sharedManager] stop];
164-
[[DConnectManager sharedManager] start];
163+
[self restartManager];
165164
default:
166165
break;
167166
}
168167
}
169168

169+
- (void)restartManager
170+
{
171+
DConnectManager *mgr = [DConnectManager sharedManager];
172+
[mgr stop];
173+
int count = 10;
174+
do {
175+
usleep(50 * 1000); //50ms
176+
if ([mgr start]) {
177+
return;
178+
}
179+
count--;
180+
} while (count > 0);
181+
}
170182

171183
///スイッチの状態を保存
172184
- (void)updateSwitchState

0 commit comments

Comments
 (0)