summaryrefslogtreecommitdiff
path: root/utils/nsoption.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2015-11-10 21:51:54 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-11-10 21:51:54 +0000
commit4d1ef3bac4ba09423a51af809ef0c9220402f050 (patch)
treec6b9dcdf2c832195ab418dcb0913ac62c3ae3b5a /utils/nsoption.c
parent727bbbd216ccd0f4c11164b54348a120f5311d40 (diff)
downloadnetsurf-4d1ef3bac4ba09423a51af809ef0c9220402f050.tar.gz
netsurf-4d1ef3bac4ba09423a51af809ef0c9220402f050.tar.bz2
Add support for retrying timed-out cURL fetches.
This is an attempt to amelioriate the situation found in #2384 where we see the cURL connect() failing to complete. Based on the pcap from the bug log, we believe that RISC OS is likely failing to signal the completion of the connection to cURL. As such, cURL times out. This change permits retries of timed out connections in the hope that a fresh socket FD might subsequently function correctly. The defaults chosen mean that the previous behaviour of 30 seconds before timeout is reported will remain the same, but in that time we will make 3 separate attempts to connect the socket.
Diffstat (limited to 'utils/nsoption.c')
-rw-r--r--utils/nsoption.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/nsoption.c b/utils/nsoption.c
index 1309ed875..ccdd23ae9 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -181,6 +181,20 @@ static void nsoption_validate(struct nsoption_s *opts, struct nsoption_s *defs)
opts[cloop].value.c = defs[cloop].value.c;
}
}
+
+ /* To aid migration and ensure that timeouts don't go crazy,
+ * ensure that (a) we allow at least 1 attempt and
+ * (b) the total time that we spend should not exceed 60s
+ */
+ if (opts[NSOPTION_max_retried_fetches].value.u == 0)
+ opts[NSOPTION_max_retried_fetches].value.u = 1;
+ if (opts[NSOPTION_curl_fetch_timeout].value.u < 5)
+ opts[NSOPTION_max_retried_fetches].value.u = 5;
+ if (opts[NSOPTION_curl_fetch_timeout].value.u > 60)
+ opts[NSOPTION_max_retried_fetches].value.u = 60;
+ while ((opts[NSOPTION_curl_fetch_timeout].value.u *
+ opts[NSOPTION_max_retried_fetches].value.u) > 60)
+ opts[NSOPTION_max_retried_fetches].value.u--;
}
/**