From 0e90827f3eb8e6c8eaa4f9d3968cfc57a4694948 Mon Sep 17 00:00:00 2001 From: Sergey Abramchuk Date: Sun, 26 Feb 2017 16:06:56 +0300 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20wait=20forever=20for=20tunnel?= =?UTF-8?q?=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenVPN Tunnel Provider/OpenVPNAdapter.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenVPN Tunnel Provider/OpenVPNAdapter.mm b/OpenVPN Tunnel Provider/OpenVPNAdapter.mm index 7f16d1e..0c57d83 100644 --- a/OpenVPN Tunnel Provider/OpenVPNAdapter.mm +++ b/OpenVPN Tunnel Provider/OpenVPNAdapter.mm @@ -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];