[PATCH setup 1/2] Improve behavior after download error
Mon Nov 6 21:49:00 GMT 2017
If the user answers "Yes" to "Download incomplete. Try again?",
simply try the download again, as the message suggests, instead of
going back to the site page. If the user answers no, don't proceed
with the install unless the user confirms that this is what they want.
The rationale for the previous behavior was presumably to let the user
choose a different mirror after a download error. But this is not
clear from the "Try again?" prompt, and it probably didn't work as
expected if the user did choose a different mirror. To make this work
right, packagedb would have to have been cleared before going to the
chooser page for the second time.
download.cc | 29 ++++++++++++++++++++---------
res.rc | 1 +
resource.h | 1 +
3 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/download.cc b/download.cc
index 80615f3..6ee64c1 100644
@@ -195,6 +195,11 @@ static int
do_download_thread (HINSTANCE h, HWND owner)
int errors = 0;
+ int retries = 5;
+ errors = 0;
total_download_bytes = 0;
total_download_bytes_sofar = 0;
@@ -271,22 +276,20 @@ do_download_thread (HINSTANCE h, HWND owner)
means that if there's a download problem, setup will
potentially retry forever if we don't take care to give
up at some finite point. */
- static int retries = 4;
- if (unattended_mode && retries-- <= 0)
+ if (unattended_mode && --retries <= 0)
Log (LOG_PLAIN) << "download error in unattended_mode: out of retries" << endLog;
Logger ().setExitMsg (IDS_INSTALL_INCOMPLETE);
Logger ().exit (1);
else if (unattended_mode)
Log (LOG_PLAIN) << "download error in unattended_mode: " << retries
<< (retries > 1 ? " retries" : " retry") << " remaining." << endLog;
- return IDD_SITE;
- else if (yesno (owner, IDS_DOWNLOAD_INCOMPLETE) == IDYES)
- return IDD_SITE;
+ else if (yesno (owner, IDS_DOWNLOAD_INCOMPLETE) == IDNO)
+ while (errors);
if (source == IDC_SOURCE_DOWNLOAD)
@@ -296,8 +299,16 @@ do_download_thread (HINSTANCE h, HWND owner)
Logger ().setExitMsg (IDS_DOWNLOAD_COMPLETE);
- return IDD_S_INSTALL;
+ if (errors)
+ if (yesno (owner, IDS_CONTINUE_INSTALL) == IDNO)
+ Logger ().setExitMsg (IDS_INSTALL_INCOMPLETE);
+ Logger ().exit (1);
+ return IDD_S_INSTALL;
static DWORD WINAPI
diff --git a/res.rc b/res.rc
index 96dcf00..40e464b 100644
@@ -523,6 +523,7 @@ BEGIN
IDS_ERR_CHDIR "Could not change dir to %s: %s [%.8x]"
IDS_OLD_SETUP_VERSION "This setup is version %s, but setup.ini claims version %s is available.\nYou might want to upgrade to get the latest features and bug fixes."
IDS_DOWNLOAD_INCOMPLETE "Download Incomplete. Try again?"
+ IDS_CONTINUE_INSTALL "Download incomplete. Continue with install anyway?"
IDS_INSTALL_ERROR "Installation error (%s), Continue with other packages?"
IDS_INSTALL_INCOMPLETE "Installation incomplete. Check %s for details"
IDS_CORRUPT_PACKAGE "Package file %s has a corrupt local copy, please remove and retry."
diff --git a/resource.h b/resource.h
index a2add84..b6685e5 100644
@@ -39,6 +39,7 @@
#define IDS_NO_LOCALDIR 138
#define IDS_ELEVATED 139
#define IDS_INSTALLEDB_VERSION 140
+#define IDS_CONTINUE_INSTALL 141
More information about the Cygwin-apps