curl: Add debug information for file downloads

Network status varies a lot and some times it's hard to understand how
one specific network condition is affecting swupd downloads. This patch
adds more information to make it easier to debug that.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit is contained in:
Otavio Pontes
2018-12-27 09:34:36 -08:00
parent 91bdebc945
commit 1779438ee2
3 changed files with 5 additions and 0 deletions
+2
View File
@@ -409,11 +409,13 @@ restart_download:
goto exit;
}
debug("CURL - start sync download: %s -> %s\n", url, in_memory_file ? "<memory>" : filename);
curl_ret = curl_easy_perform(curl);
if (curl_ret == CURLE_OK || curl_ret == CURLE_HTTP_RETURNED_ERROR) {
curl_ret = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &ret);
}
debug("CURL - completed sync download: curl ret %d, http response %d\n", curl_ret, ret);
exit:
if (!in_memory_file) {
curl_ret = swupd_download_file_complete(curl_ret, &local);
+2
View File
@@ -258,6 +258,7 @@ static int perform_curl_io_and_complete(struct swupd_curl_parallel_handle *h, in
}
local_download = strncmp(url, "file://", 7) == 0;
debug("CURL - complete ASYNC download: %s -> %s\n", file->url, file->file.path);
/* Get error code from easy handle and augment it if
* completing the download encounters further problems. */
curl_ret = swupd_download_file_complete(msg->data.result, &file->file);
@@ -458,6 +459,7 @@ static int process_download(struct swupd_curl_parallel_handle *h, struct multi_c
goto out_bad;
}
debug("CURL - start ASYNC download: %s -> %s\n", file->url, file->file.path);
curlm_ret = curl_multi_add_handle(h->mcurl, curl);
if (curlm_ret != CURLM_OK) {
goto out_bad;
+1
View File
@@ -15,6 +15,7 @@
#include "lib/macros.h"
#include "lib/strings.h"
#include "lib/sys.h"
#include "lib/log.h"
#include "swupd-error.h"
#include "timelist.h"