From 8853ccbfe01df459a3d72ca9b39338b0ce6222ee Mon Sep 17 00:00:00 2001 From: clobber Date: Tue, 5 Jan 2021 11:51:34 -0700 Subject: [PATCH] fix: Don't timeout XPC connections in the debugger. --- Source/NSXPCConnection+HelperApp.m | 6 +++++- Source/NSXPCListener+HelperApp.m | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/NSXPCConnection+HelperApp.m b/Source/NSXPCConnection+HelperApp.m index 1d9e276..878c777 100644 --- a/Source/NSXPCConnection+HelperApp.m +++ b/Source/NSXPCConnection+HelperApp.m @@ -92,7 +92,10 @@ int xpc_task_key = 0; endpoint = ep; dispatch_semaphore_signal(sem); }]; - + +#ifdef DEBUG_PRINT + dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); +#else dispatch_time_t waitTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(NSEC_PER_SEC * 2)); if (dispatch_semaphore_wait(sem, waitTime) != 0) { @@ -106,6 +109,7 @@ int xpc_task_key = 0; }]; } } +#endif [cn setInvalidationHandler:nil]; [cn invalidate]; diff --git a/Source/NSXPCListener+HelperApp.m b/Source/NSXPCListener+HelperApp.m index e6c6fd7..4b1038c 100644 --- a/Source/NSXPCListener+HelperApp.m +++ b/Source/NSXPCListener+HelperApp.m @@ -69,7 +69,10 @@ extern NSString *kHelperIdentifierArgumentPrefix; os_log_info(OE_LOG_HELPER, "Successfully connected helper to host. { id = '%{public}@' }", identifier); dispatch_semaphore_signal(sem); }]; - + +#ifdef DEBUG_PRINT + dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); +#else dispatch_time_t waitTime = dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 2); if (dispatch_semaphore_wait(sem, waitTime) != 0) { @@ -78,6 +81,7 @@ extern NSString *kHelperIdentifierArgumentPrefix; [listener invalidate]; listener = nil; } +#endif [cn setInvalidationHandler:nil]; [cn invalidate];