Skip to content

Commit

Permalink
Fix Large Incremental Installs (#470)
Browse files Browse the repository at this point in the history
Fix timeouts that happen with large Incremental installs
  • Loading branch information
ivanhernandez13 authored Aug 19, 2020
1 parent 3b4f011 commit 89c509b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/ios-deploy/ios-deploy.m
Original file line number Diff line number Diff line change
Expand Up @@ -1994,12 +1994,11 @@ void handle_device(AMDeviceRef device) {
NSLogOut(@"------ Install phase ------");
NSLogOut(@"[ 0%%] Found %@ connected through %@, beginning install", device_full_name, device_interface_name);

connect_and_start_session(device);

CFDictionaryRef options;
if (app_deltas == NULL) { // standard install
// NOTE: the secure version doesn't seem to require us to start the AFC service
ServiceConnRef afcFd;
connect_and_start_session(device);
check_error(AMDeviceSecureStartService(device, CFSTR("com.apple.afc"), NULL, &afcFd));
check_error(AMDeviceStopSession(device));
check_error(AMDeviceDisconnect(device));
Expand All @@ -2012,10 +2011,9 @@ void handle_device(AMDeviceRef device) {

connect_and_start_session(device);
check_error(AMDeviceSecureInstallApplication(0, device, url, options, install_callback, 0));
} else { // incremental install
check_error(AMDeviceStopSession(device));
check_error(AMDeviceDisconnect(device));

} else { // incremental install
CFStringRef extracted_bundle_id = NULL;
CFStringRef extracted_bundle_id_ref = copy_bundle_id(url);
if (bundle_id != NULL) {
Expand Down Expand Up @@ -2058,7 +2056,7 @@ void handle_device(AMDeviceRef device) {
CFIndex size = sizeof(keys)/sizeof(CFStringRef);
options = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, size, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);

connect_and_start_session(device);
// Incremental installs should be done without a session started because of timeouts.
check_error(AMDeviceSecureInstallApplicationBundle(device, url, options, incremental_install_callback, 0));
CFRelease(extracted_bundle_id);
CFRelease(deltas_path);
Expand All @@ -2068,9 +2066,6 @@ void handle_device(AMDeviceRef device) {
app_deltas = NULL;
}

check_error(AMDeviceStopSession(device));
check_error(AMDeviceDisconnect(device));

CFRelease(options);

NSLogOut(@"[100%%] Installed package %@", [NSString stringWithUTF8String:app_path]);
Expand Down

0 comments on commit 89c509b

Please sign in to comment.