Commit 426f72dec7bcada1f417fbdb8b6b87123716cb59

Con Kolivas 2011-08-16T10:27:19

As we have keepalives now, blaming network flakiness on timeouts appears to have been wrong. Set a timeout for longpoll to 1 hour, and most other network connectivity to 1 minute.

diff --git a/util.c b/util.c
index 7b04c6b..563b5f6 100644
--- a/util.c
+++ b/util.c
@@ -311,6 +311,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
 	struct curl_slist *headers = NULL;
 	char len_hdr[64], user_agent_hdr[128];
 	char curl_err_str[CURL_ERROR_SIZE];
+	long timeout = longpoll ? (60 * 60) : 60;
 	struct header_info hi = { };
 	bool probing = false;
 
@@ -318,9 +319,10 @@ json_t *json_rpc_call(CURL *curl, const char *url,
 
 	if (probe) {
 		probing = ((want_longpoll && !have_longpoll) || !pool->probed);
-		/* Probe for only 14 seconds */
-		curl_easy_setopt(curl, CURLOPT_TIMEOUT, 15);
+		/* Probe for only 15 seconds */
+		timeout = 15;
 	}
+	curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
 
 	if (opt_protocol)
 		curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);