From 67b08cd8b90d58b44a556a15c18ec89691a364a7 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 30 May 2018 22:06:20 -0700 Subject: [PATCH] Use LiInterruptConnection() to terminate connection attempts more quickly --- Limelight/Stream/Connection.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Limelight/Stream/Connection.m b/Limelight/Stream/Connection.m index 96051f7..39ca7fa 100644 --- a/Limelight/Stream/Connection.m +++ b/Limelight/Stream/Connection.m @@ -240,6 +240,12 @@ void ClLogMessage(const char* format, ...) -(void) terminate { + // Interrupt any action blocking LiStartConnection(). This is + // thread-safe and done outside initLock on purpose, since we + // won't be able to acquire it if LiStartConnection is in + // progress. + LiInterruptConnection(); + // We dispatch this async to get out because this can be invoked // on a thread inside common and we don't want to deadlock. It also avoids // blocking on the caller's thread waiting to acquire initLock.