Fix Large Incremental Installs (#470)
Fix timeouts that happen with large Incremental installs
diff --git a/src/ios-deploy/ios-deploy.m b/src/ios-deploy/ios-deploy.m
index de8a608..25ea073 100644
--- a/src/ios-deploy/ios-deploy.m
+++ b/src/ios-deploy/ios-deploy.m
@@ -1994,12 +1994,11 @@
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));
@@ -2012,10 +2011,9 @@
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) {
@@ -2058,7 +2056,7 @@
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);
@@ -2068,9 +2066,6 @@
app_deltas = NULL;
}
- check_error(AMDeviceStopSession(device));
- check_error(AMDeviceDisconnect(device));
-
CFRelease(options);
NSLogOut(@"[100%%] Installed package %@", [NSString stringWithUTF8String:app_path]);