diff options
author | erdgeist <> | 2007-01-12 01:22:03 +0000 |
---|---|---|
committer | erdgeist <> | 2007-01-12 01:22:03 +0000 |
commit | 575bf7081ffa5d79ab8a752aa15f9980982c97ce (patch) | |
tree | 3b7e6cb969eb1661ee4f25f19c145306c274ac51 | |
parent | 805e46450cfa9400e30fd124c893dda18e050f2b (diff) |
casting does floor() by itself
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | trackerlogic.c | 2 |
2 files changed, 8 insertions, 1 deletions
@@ -19,3 +19,10 @@ This tracker is open in a sense that everyone announcing a torrent is welcome to | |||
19 | -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 | 19 | -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 |
20 | 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 | 20 | 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 |
21 | more of our testsuite.sh script). | 21 | more of our testsuite.sh script). |
22 | |||
23 | Some tweaks you may want to try under FreeBSD: | ||
24 | |||
25 | sysctl kern.ipc.somaxconn=1024 | ||
26 | sysctl kern.ipc.nmbclusters=32768 | ||
27 | sysctl net.inet.tcp.msl=10000 | ||
28 | 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 | |||
256 | r += sprintf( r, "d8:completei%ie10:incompletei%ie8:intervali600e5:peers%i:", seed_count, peer_count-seed_count, 6*amount ); | 256 | r += sprintf( r, "d8:completei%ie10:incompletei%ie8:intervali600e5:peers%i:", seed_count, peer_count-seed_count, 6*amount ); |
257 | for( index = 0; index < amount; ++index ) { | 257 | for( index = 0; index < amount; ++index ) { |
258 | double step = 1.8*((double)( peer_count - wert - 1 ))/((double)( amount - index )); | 258 | double step = 1.8*((double)( peer_count - wert - 1 ))/((double)( amount - index )); |
259 | int off = random() % (int)floor( step ); | 259 | int off = random() % (int)step; |
260 | off = 1 + ( off % ( peer_count - wert - 1 )); | 260 | off = 1 + ( off % ( peer_count - wert - 1 )); |
261 | wert += off; pool_offset += off; | 261 | wert += off; pool_offset += off; |
262 | 262 | ||