[AltServer] Enforces one installation at a time

Blocks dispatch queue until installation finishes, at which point the next installation can begin.
This commit is contained in:
Riley Testut
2019-06-19 11:04:15 -07:00
parent 232f5f5b98
commit c096fd02b4

View File

@@ -319,6 +319,8 @@ NSErrorDomain const ALTDeviceErrorDomain = @"com.rileytestut.ALTDeviceError";
client = NULL;
}
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
NSProgress *installationProgress = [NSProgress progressWithTotalUnitCount:100 parent:progress pendingUnitCount:1];
self.installationProgress[UUID] = installationProgress;
@@ -333,12 +335,16 @@ NSErrorDomain const ALTDeviceErrorDomain = @"com.rileytestut.ALTDeviceError";
NSLog(@"Error removing temporary directory. %@", error);
}
}
dispatch_semaphore_signal(semaphore);
};
NSLog(@"Installing to device %@...", udid);
instproxy_install(ipc, destinationURL.relativePath.fileSystemRepresentation, options, ALTDeviceManagerUpdateStatus, uuidString);
instproxy_client_options_free(options);
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
});
return progress;