Don’t wait forever for tunnel configuration

This commit is contained in:
Sergey Abramchuk
2017-02-26 16:06:56 +03:00
parent 4daa634f6c
commit 0e90827f3e
+5 -1
View File
@@ -199,7 +199,11 @@ static void socketCallback(CFSocketRef socket, CFSocketCallBackType type, CFData
dispatch_semaphore_signal(sema);
}];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, 30 * NSEC_PER_SEC);
if (dispatch_semaphore_wait(sema, timeout) != 0) {
NSLog(@"Tunnel configuration failed due to timeout");
return -1;
}
if (self.packetFlow) {
[self readTUNPackets];