tracker code.master
@@ -111,10 +111,8 @@ http_td_cb(void *arg) | |||||
struct http *h = arg; | struct http *h = arg; | ||||
if (h->res.res == HRES_OK) | if (h->res.res == HRES_OK) | ||||
curl_easy_getinfo(h->curlh, CURLINFO_RESPONSE_CODE, &h->res.code); | curl_easy_getinfo(h->curlh, CURLINFO_RESPONSE_CODE, &h->res.code); | ||||
if (h->res.res == HRES_FAIL) { | |||||
btpd_log(BTPD_L_ERROR, "Http error for url '%s' (%s).\n", h->url, | |||||
curl_easy_strerror(h->res.code)); | |||||
} | |||||
if (h->res.res == HRES_FAIL) | |||||
h->res.errmsg = curl_easy_strerror(h->res.code); | |||||
if (h->state != HS_CANCEL) | if (h->state != HS_CANCEL) | ||||
h->cb(h, &h->res, h->cb_arg); | h->cb(h, &h->res, h->cb_arg); | ||||
curl_easy_cleanup(h->curlh); | curl_easy_cleanup(h->curlh); | ||||
@@ -12,6 +12,7 @@ enum http_status { | |||||
struct http_res { | struct http_res { | ||||
enum http_status res; | enum http_status res; | ||||
long code; | long code; | ||||
const char *errmsg; | |||||
char *content; | char *content; | ||||
size_t length; | size_t length; | ||||
}; | }; | ||||
@@ -141,6 +141,9 @@ http_cb(struct http *req, struct http_res *res, void *arg) | |||||
tr->ttype = TIMER_INTERVAL; | tr->ttype = TIMER_INTERVAL; | ||||
event_add(&tr->timer, (& (struct timeval) { tr->interval, 0 })); | event_add(&tr->timer, (& (struct timeval) { tr->interval, 0 })); | ||||
} else { | } else { | ||||
if (res->res == HRES_FAIL) | |||||
btpd_log(BTPD_L_BTPD, "Tracker request for '%s' failed (%s).\n", | |||||
torrent_name(tp), res->errmsg); | |||||
tr->nerrors++; | tr->nerrors++; | ||||
tr->ttype = TIMER_RETRY; | tr->ttype = TIMER_RETRY; | ||||
event_add(&tr->timer, RETRY_WAIT); | event_add(&tr->timer, RETRY_WAIT); | ||||