From 575bf7081ffa5d79ab8a752aa15f9980982c97ce Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Fri, 12 Jan 2007 01:22:03 +0000 Subject: [PATCH] casting does floor() by itself --- README | 7 +++++++ trackerlogic.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README b/README index 17db7de..53ba0de 100644 --- a/README +++ b/README @@ -19,3 +19,10 @@ This tracker is open in a sense that everyone announcing a torrent is welcome to -DWANT_IP_FROM_QUERY_STRING is enabled (which is meant for debugging purposes only), only source IPs are accepted. The tracker implements a minimal set of essential features only but was able respond to far more than 10000 requests per second on a Sun Fire 2200 M2 (thats where we found no more clients able to fire more of our testsuite.sh script). + +Some tweaks you may want to try under FreeBSD: + +sysctl kern.ipc.somaxconn=1024 +sysctl kern.ipc.nmbclusters=32768 +sysctl net.inet.tcp.msl=10000 +sysctl kern.maxfiles=10240 diff --git a/trackerlogic.c b/trackerlogic.c index 2b8ffaf..b3aacc0 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -256,7 +256,7 @@ size_t return_peers_for_torrent( ot_torrent *torrent, unsigned int amount, char r += sprintf( r, "d8:completei%ie10:incompletei%ie8:intervali600e5:peers%i:", seed_count, peer_count-seed_count, 6*amount ); for( index = 0; index < amount; ++index ) { double step = 1.8*((double)( peer_count - wert - 1 ))/((double)( amount - index )); - int off = random() % (int)floor( step ); + int off = random() % (int)step; off = 1 + ( off % ( peer_count - wert - 1 )); wert += off; pool_offset += off;