Skip to content

Commit e9901db

Browse files
committed
Revert "casync-http: retry when curl fails to connect"
This reverts commit 328f13d.
1 parent bc85e26 commit e9901db

File tree

1 file changed

+2
-42
lines changed

1 file changed

+2
-42
lines changed

src/casync-http.c

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <curl/curl.h>
44
#include <getopt.h>
55
#include <stddef.h>
6-
#include <unistd.h>
76

87
#include "caprotocol.h"
98
#include "caremote.h"
@@ -172,45 +171,6 @@ static int make_curl_easy_handle(CURL **ret,
172171
return 0;
173172
}
174173

175-
static CURLcode robust_curl_easy_perform(CURL *curl) {
176-
uint64_t sleep_base_usec = 100 * 1000;
177-
unsigned trial = 1;
178-
unsigned limit = 10;
179-
CURLcode c;
180-
181-
assert(curl);
182-
183-
while (trial < limit) {
184-
185-
c = curl_easy_perform(curl);
186-
187-
switch (c) {
188-
189-
case CURLE_COULDNT_CONNECT: {
190-
uint64_t sleep_usec;
191-
192-
/* Although this is not considered as a transient error by curl,
193-
* this error can happen momentarily while casync is retrieving
194-
* all the chunks from a remote. In this case we want to give
195-
* a break to the server and retry later.
196-
*/
197-
198-
sleep_usec = sleep_base_usec * trial;
199-
log_info("Could not connect, retrying in %" PRIu64 " ms", sleep_usec / 1000);
200-
usleep(sleep_usec);
201-
trial++;
202-
break;
203-
}
204-
205-
default:
206-
return c;
207-
break;
208-
}
209-
}
210-
211-
return c;
212-
}
213-
214174
static int process_remote(CaRemote *rr, ProcessUntil until) {
215175
int r;
216176

@@ -453,7 +413,7 @@ static int acquire_file(CaRemote *rr, CURL *handle) {
453413

454414
log_debug("Acquiring %s...", url);
455415

456-
c = robust_curl_easy_perform(handle);
416+
c = curl_easy_perform(handle);
457417
if (c != CURLE_OK)
458418
return log_error_curle(c, "Failed to acquire %s", url);
459419

@@ -528,7 +488,7 @@ static int acquire_chunks(CaRemote *rr, const char *store_url) {
528488

529489
log_debug("Acquiring %s...", url_buffer);
530490

531-
c = robust_curl_easy_perform(curl);
491+
c = curl_easy_perform(curl);
532492
if (c != CURLE_OK)
533493
return log_error_curle(c, "Failed to acquire %s", url_buffer);
534494

0 commit comments

Comments
 (0)