Pārlūkot izejas kodu

I had missed a check for tracker errors. When a torrent is stopping it's

supposed to stop if it can't contact the tracker in STOP_ERRORS tries.
master
Richard Nyberg pirms 17 gadiem
vecāks
revīzija
630f11d18b
1 mainītis faili ar 15 papildinājumiem un 11 dzēšanām
  1. +15
    -11
      btpd/tracker_req.c

+ 15
- 11
btpd/tracker_req.c Parādīt failu

@@ -97,6 +97,16 @@ tr_cancel(struct tracker *tr)
tr->req = NULL;
}

static void
tr_set_stopped(struct torrent *tp)
{
struct tracker *tr = tp->tr;
btpd_ev_del(&tr->timer);
tr->ttype = TIMER_NONE;
if (tr->req != NULL)
tr_cancel(tr);
}

static void
tr_send(struct torrent *tp, enum tr_event event)
{
@@ -117,8 +127,12 @@ tr_send(struct torrent *tp, enum tr_event event)

if ((op == NULL ||
(tr->req = op->request(tp, event, get_url(tr))) == NULL)) {
next_url(tr);
tr->nerrors++;
if (tr->event == TR_EV_STOPPED && tr->nerrors >= STOP_ERRORS) {
tr_set_stopped(tp);
return;
}
next_url(tr);
tr->ttype = TIMER_RETRY;
btpd_ev_add(&tr->timer, (& (struct timeval) { 5, 0 }));
} else {
@@ -128,16 +142,6 @@ tr_send(struct torrent *tp, enum tr_event event)
}
}

static void
tr_set_stopped(struct torrent *tp)
{
struct tracker *tr = tp->tr;
btpd_ev_del(&tr->timer);
tr->ttype = TIMER_NONE;
if (tr->req != NULL)
tr_cancel(tr);
}

void
tr_result(struct torrent *tp, enum tr_res res, int interval)
{


Notiek ielāde…
Atcelt
Saglabāt