Selaa lähdekoodia

Added 'numwant' to the tracker request parameters.

This specifies the number of wanted peers to the tracker and is
configurable from the commandline flag "--numwant".

Closes GH-5
master
Marq Schneider 14 vuotta sitten
vanhempi
commit
9667cf0694
4 muutettua tiedostoa jossa 11 lisäystä ja 2 poistoa
  1. +2
    -2
      btpd/http_tr_if.c
  2. +7
    -0
      btpd/main.c
  3. +1
    -0
      btpd/opts.c
  4. +1
    -0
      btpd/opts.h

+ 2
- 2
btpd/http_tr_if.c Näytä tiedosto

@@ -215,11 +215,11 @@ httptr_req(struct torrent *tp, struct tr_tier *tr, const char *aurl,

snprintf(url, sizeof(url),
"%s%cinfo_hash=%s&peer_id=%s&key=%ld%s%s&port=%d&uploaded=%llu"
"&downloaded=%llu&left=%llu&compact=1%s%s",
"&downloaded=%llu&left=%llu&compact=1&numwant=%u%s%s",
aurl, qc, e_hash, e_id, tr_key,
tr_ip_arg == NULL ? "" : "&ip=", tr_ip_arg == NULL ? "" : tr_ip_arg,
net_port, tp->net->uploaded, tp->net->downloaded,
(long long)tp->total_length - cm_content(tp),
(long long)tp->total_length - cm_content(tp), net_numwant,
event == TR_EV_EMPTY ? "" : "&event=", m_tr_events[event]);

struct httptr_req *treq = btpd_calloc(1, sizeof(*treq));


+ 7
- 0
btpd/main.c Näytä tiedosto

@@ -159,6 +159,9 @@ usage(void)
"\tPreallocate disk space in chunks of n kB. Default is 2048.\n"
"\tNote that n will be rounded up to the closest multiple of the\n"
"\ttorrent piece size. If n is zero no preallocation will be done.\n"
"\n"
"--numwant n\n"
"\tSet the number of peers to fetch on each request. Default is 50.\n"
"\n");
exit(1);
}
@@ -178,6 +181,7 @@ static struct option longopts[] = {
{ "empty-start", no_argument, &longval, 9 },
{ "ip", required_argument, &longval, 10 },
{ "logmask", required_argument, &longval, 11 },
{ "numwant", required_argument, &longval, 12 },
{ "help", no_argument, &longval, 128 },
{ NULL, 0, NULL, 0 }
};
@@ -239,6 +243,9 @@ main(int argc, char **argv)
case 11:
btpd_logmask = atoi(optarg);
break;
case 12:
net_numwant = (unsigned)atoi(optarg);
break;
default:
usage();
}


+ 1
- 0
btpd/opts.c Näytä tiedosto

@@ -13,3 +13,4 @@ int empty_start = 0;
const char *tr_ip_arg;
int net_ipv4 = 1;
int net_ipv6 = 0;
unsigned net_numwant = 50;

+ 1
- 0
btpd/opts.h Näytä tiedosto

@@ -13,5 +13,6 @@ extern int ipcprot;
extern int empty_start;
extern const char *tr_ip_arg;
extern int net_ipv4, net_ipv6;
extern unsigned net_numwant;

#endif

Loading…
Peruuta
Tallenna