I notice that my ISP logs the amount of usage on each port. That means that using bittorrent with the same range results in the first 2 or 3 ports of that range being the major consumers. In order to spread some confusion, I thought to randomize the port I'm using. Well, it turned out to be two lines of change:
SocketHandler.py
< from random import shuffle
to
> from random import shuffle, sample
< for listen_port in xrange(minport, maxport+1):
to
> for listen_port in sample(xrange(minport, maxport+1), maxport-minport):
This should randomize the list and then start walking through it, looking for a port that's unbound. It should not duplicate entries and should cover all the ports in the range.
This change makes every run allocate a random port, and it should instead be set a runtime option (i.e. --random_port), I imagine. I only wanted random ports, so I didn't go that far.
It would also be neat to make launchmany allocate a random port to each file you're swarming, though this is a lot more work. I know a lot of people were all stoked about having a single port for all the torrents, but it's not that important. I also thought that maybe changing to another random port at some interval, but again, this is a lot of work.
|