Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 9667cf0694245ead296a4d79a1579448a625fd60 1 parent 6406029
@queueRAM queueRAM authored
Showing with 11 additions and 2 deletions.
  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
View
4 btpd/http_tr_if.c
@@ -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));
View
7 btpd/main.c
@@ -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();
}
View
1  btpd/opts.c
@@ -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;
View
1  btpd/opts.h
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.