shithub: riscv

Download patch

ref: d310da13ba8d31c84978f96f542b9929a4e54ed8
parent: 3e880cd07d5d51005e48b7ea261a1419b84f134d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Oct 11 22:03:52 EDT 2020

ip/torrent: try harder allocating ports

we used to only allocate ports from 6881 to 6890,
which limits the maximum of parallel torrents to 9.

this change make it go up to 9000, which gives us
at best 2120 ports, which is overkill but ports might
be randomly occupied by other connections.

--- a/sys/src/cmd/ip/torrent.c
+++ b/sys/src/cmd/ip/torrent.c
@@ -605,7 +605,7 @@
 
 	afd = -1;
 	nprocs = 0;
-	for(port=6881; port<6890; port++){
+	for(port=6881; port<9000; port++){
 		snprint(addr, sizeof(addr), "tcp!*!%d", port);
 		if((afd = announce(addr, adir)) >= 0)
 			break;