From 5803ce1a73a80faaf27aa371144dfa23fc1af1bd Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 23 Mar 2009 13:58:24 +0000 Subject: [PATCH] libcurl: if a resume ended up with an invalid pack, redownload the FULL pack git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8823 d7cf8633-e32d-0410-b094-e92efae38249 --- libcurl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libcurl.c b/libcurl.c index 58c01785..4eac714a 100644 --- a/libcurl.c +++ b/libcurl.c @@ -441,6 +441,7 @@ CURL_DOWNLOAD_FAILED or CURL_DOWNLOAD_ABORTED) and in the second case the error code from libcurl, or 0, if another error has occurred. ==================== */ +static qboolean Curl_Begin(const char *URL, const char *name, qboolean ispak, qboolean forthismap, unsigned char *buf, size_t bufsize, curl_callback_t callback, void *cbdata); static void Curl_EndDownload(downloadinfo *di, CurlStatus status, CURLcode error) { qboolean ok = false; @@ -500,6 +501,14 @@ static void Curl_EndDownload(downloadinfo *di, CurlStatus status, CURLcode error // better clear the file again... di->stream = FS_OpenRealFile(di->filename, "wb", false); FS_Close(di->stream); + + if(di->startpos && !di->callback) + { + // this was a resume? + // then try to redownload it without reporting the error + Curl_Begin(di->url, di->filename, di->ispak, di->forthismap, NULL, 0, NULL, NULL); + di->forthismap = false; // don't count the error + } } } @@ -801,7 +810,7 @@ static qboolean Curl_Begin(const char *URL, const char *name, qboolean ispak, qb di->startpos = 0; di->curle = NULL; di->started = false; - di->ispak = ispak; + di->ispak = (ispak && !buf); di->bytes_received = 0; di->next = downloads; di->prev = NULL; -- 2.39.2