]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
account downloaded before early returns
authorerdgeist <>
Sat, 27 Jan 2007 16:06:13 +0000 (16:06 +0000)
committererdgeist <>
Sat, 27 Jan 2007 16:06:13 +0000 (16:06 +0000)
README
README_v6
opentracker.c
scan_urlencoded_query.c
scan_urlencoded_query.h
trackerlogic.c
trackerlogic.h

diff --git a/README b/README
index 1890400ff9b92aec63cd372c26de23f8669960f4..8fac50b57e5d68e942c97b59fa403bf69f42c50e 100644 (file)
--- a/README
+++ b/README
@@ -15,9 +15,9 @@ cd opentracker-1.0
 make
 ./opentracker
 
-This tracker is open in a sense that everyone announcing a torrent is welcome to do so and will be informed about anyone else announcing the same torrent. Unless 
--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 
+This tracker is open in a sense that everyone announcing a torrent is welcome to do so and will be informed about anyone else announcing the same torrent. Unless
+-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:
index 72d25a3ba71d69923c49072e110a3136725ea192..6a5a82a3f9572dfc5a6eba18c72d71e342957fc2 100644 (file)
--- a/README_v6
+++ b/README_v6
@@ -1,8 +1,8 @@
 Q: Why is there no v6-support in opentracker?
 
-A: Although I tried very hard, implementing v6 right now would be a terrible waste of bandwidth, there is no compact format for v6 addresses, so instead of 
-answering "d5:peers6:AAAAPPe" I'd have to send "d5:peersld2:ip39:AAAA:AAAA:AAAA:AAAA:AAAA:AAAA:AAAA:AAAA4:port2:PPPPeee" for a single peer. Even if there was a 
+A: Although I tried very hard, implementing v6 right now would be a terrible waste of bandwidth, there is no compact format for v6 addresses, so instead of
+answering "d5:peers6:AAAAPPe" I'd have to send "d5:peersld2:ip39:AAAA:AAAA:AAAA:AAAA:AAAA:AAAA:AAAA:AAAA4:port2:PPPPeee" for a single peer. Even if there was a
 compact mode, v6 addresses still would eat up thrice the memory, v4 addresses take. This, however, wouldn't be a show stopper.
 
-Other problems concern efficient peer selection for obviously v6-capable peers and how to select peers for non-v6 clients. v6 addresses eat up more memory on the 
+Other problems concern efficient peer selection for obviously v6-capable peers and how to select peers for non-v6 clients. v6 addresses eat up more memory on the
 host, too ;)
index f69ae70ff6b1e2eb53ce7d6930554e2527e96a7d..e415cc351588a617e40466fc13e4c08cc93d4562 100644 (file)
@@ -285,7 +285,7 @@ SCRAPE_WORKAROUND:
     /* Enough for http header + whole scrape string */
     if( ( reply_size = return_scrape_for_torrent( hash, SUCCESS_HTTP_HEADER_LENGTH + static_scratch ) ) <= 0 ) HTTPERROR_500;
     break;
-  case 8: 
+  case 8:
     if( byte_diff(data,8,"announce")) HTTPERROR_404;
 
 ANNOUNCE_WORKAROUND:
@@ -383,7 +383,7 @@ ANNOUNCE_WORKAROUND:
     if( byte_diff(data,11,"mrtg_scrape")) HTTPERROR_404;
 
     t = time( NULL ) - ot_start_time;
-    reply_size = sprintf( static_scratch + SUCCESS_HTTP_HEADER_LENGTH, 
+    reply_size = sprintf( static_scratch + SUCCESS_HTTP_HEADER_LENGTH,
                           "%i\n%i\nUp: %i seconds (%i hours)\nPretuned by german engineers, currently handling %i connections per second.",
                           ot_overall_connections, ot_overall_successfulannounces, (int)t, (int)(t / 3600), (int)ot_overall_connections / ( (int)t ? (int)t : 1 ) );
     break;
index ff382462d2ff2b54a2bee231809fa68074738937..dc43b616c043d3fc63cece3649fd48a7bd5e5895 100644 (file)
@@ -1,4 +1,4 @@
-/* This software was written by Dirk Engling <erdgeist@erdgeist.org> 
+/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
    It is considered beerware. Prost. Skol. Cheers or whatever. */
 
 #include "scan.h"
index 766327835682cc84060204ad77edbac6766f89a8..e20cbefb98c223669c43e5880b23e73bd2f953dc 100644 (file)
@@ -1,4 +1,4 @@
-/* This software was written by Dirk Engling <erdgeist@erdgeist.org> 
+/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
    It is considered beerware. Prost. Skol. Cheers or whatever. */
 
 #ifndef __SCAN_URLENCODED_QUERY_H__
index 83a4eba7ad3d5341f2c3471a8beed818bc858e89..6b8dba53a593193e67fbdb8624ec8f635950fd67 100644 (file)
@@ -195,6 +195,9 @@ ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer ) {
   peer_pool = &torrent->peer_list->peers[0];
   peer_dest = vector_find_or_insert( peer_pool, (void*)peer, sizeof( ot_peer ), OT_PEER_COMPARE_SIZE, &exactmatch );
 
+  if( OT_FLAG(peer) & PEER_FLAG_COMPLETED )
+    torrent->peer_list->downloaded++;
+
   /* If we hadn't had a match in current pool, create peer there and
      remove it from all older pools */
   if( !exactmatch ) {
@@ -215,8 +218,6 @@ ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer ) {
     if( !(OT_FLAG(peer_dest) & PEER_FLAG_SEEDING ) && (OT_FLAG(peer) & PEER_FLAG_SEEDING ) )
       torrent->peer_list->seed_count[0]++;
   }
-  if( OT_FLAG(peer) & PEER_FLAG_COMPLETED )
-    torrent->peer_list->downloaded++;
 
   return torrent;
 }
@@ -435,13 +436,13 @@ void remove_peer_from_torrent( ot_hash *hash, ot_peer *peer ) {
   int          exactmatch, i;
   ot_vector   *torrents_list = &all_torrents[*hash[0]];
   ot_torrent  *torrent = binary_search( hash, torrents_list->data, torrents_list->size, sizeof( ot_torrent ), OT_HASH_COMPARE_SIZE, &exactmatch );
-  
+
   if( !exactmatch ) return;
-  
+
   /* Maybe this does the job */
   if( clean_peerlist( NOW, torrent->peer_list ) ) {
 #ifdef WANT_CLOSED_TRACKER
-    if( !g_closedtracker ) 
+    if( !g_closedtracker )
 #endif
     vector_remove_torrent( torrents_list, hash );
     return;
index 083c437c87a6832d616870dbf9631de082bbfa27..a3335f34f641274b83f9c2197eda7ed2bf84d88f 100644 (file)
@@ -1,4 +1,4 @@
-/* This software was written by Dirk Engling <erdgeist@erdgeist.org> 
+/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
    It is considered beerware. Prost. Skol. Cheers or whatever. */
 
 #ifndef __TRACKERLOGIC_H__
@@ -44,7 +44,7 @@ typedef time_t         ot_time;
 typedef struct {
   void   *data;
   size_t  size;
-  size_t  space;   
+  size_t  space;
 } ot_vector;
 
 typedef struct {