Преглед на файлове

Add function to get tracker error count. Don't look for peers and stuff

in tracker replies when we're stopping.
master
Richard Nyberg преди 19 години
родител
ревизия
886fb651d8
променени са 2 файла, в които са добавени 10 реда и са изтрити 2 реда
  1. +9
    -2
      btpd/tracker_req.c
  2. +1
    -0
      btpd/tracker_req.h

+ 9
- 2
btpd/tracker_req.c Целия файл

@@ -130,8 +130,9 @@ http_cb(struct http *req, struct http_res *res, void *arg)
struct tracker *tr = tp->tr; struct tracker *tr = tp->tr;
assert(tr->ttype == TIMER_TIMEOUT); assert(tr->ttype == TIMER_TIMEOUT);
tr->req = NULL; tr->req = NULL;
if ((http_succeeded(res) && if (res->res == HRES_OK &&
parse_reply(tp, res->content, res->length) == 0)) { (tr->event == TR_EV_STOPPED
|| parse_reply(tp, res->content, res->length) == 0)) {
tr->nerrors = 0; tr->nerrors = 0;
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 }));
@@ -249,3 +250,9 @@ tr_stop(struct torrent *tp)
{ {
tr_send(tp, TR_EV_STOPPED); tr_send(tp, TR_EV_STOPPED);
} }

unsigned
tr_errors(struct torrent *tp)
{
return tp->tr->nerrors;
}

+ 1
- 0
btpd/tracker_req.h Целия файл

@@ -6,5 +6,6 @@ void tr_stop(struct torrent *tp);
void tr_refresh(struct torrent *tp); void tr_refresh(struct torrent *tp);
void tr_complete(struct torrent *tp); void tr_complete(struct torrent *tp);
void tr_destroy(struct torrent *tp); void tr_destroy(struct torrent *tp);
unsigned tr_errors(struct torrent *tp);


#endif #endif

||||||
x
 
000:0
Loading…
Отказ
Запис