]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
There is a pool leak somewhere... try to find it
authorerdgeist <>
Sat, 6 Oct 2007 19:17:21 +0000 (19:17 +0000)
committererdgeist <>
Sat, 6 Oct 2007 19:17:21 +0000 (19:17 +0000)
trackerlogic.c

index 7d50ed45dc57c84c365adc36ae0763e2f2fbbe24..9ca283e7fd1a5f4fdd5dd9b42b7d0face81776c6 100644 (file)
@@ -550,8 +550,17 @@ void clean_all_torrents( void ) {
       }
 
       /* If nothing to be cleaned here, handle next torrent */
-      if( timedout > OT_POOLS_COUNT )
-        continue;
+      if( timedout > OT_POOLS_COUNT ) {
+
+        peers_count = 0;
+        for( k = 0; k < OT_POOLS_COUNT; ++k )
+          peers_count += peer_list->peers[k].size;
+
+        if( !peers_count )
+          continue;
+
+        timedout = OT_POOLS_COUNT;
+      }
 
       /* Release vectors that have timed out */
       for( k = OT_POOLS_COUNT - timedout; k < OT_POOLS_COUNT; ++k )