From 2df09905f5540fee096d48a92cb0c42558498a12 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Fri, 2 Jan 2009 08:57:53 +0000 Subject: * opentracker now drops permissions in correct order and really chroots() if ran as root * lock passing between add_peer_to_torrent and return_peers_for_torrent is now avoided by providing a more general add_peer_to_torrent_and_return_peers function that can be used with NULL parameters to not return any peers (in sync case) * in order to keep a fast overview how many torrents opentracker maintains, every mutex_bucket_unlock operation expects an additional integer parameter that tells ot_mutex.c how many torrents have been added or removed. A function mutex_get_torrent_count has been introduced. --- ot_fullscrape.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ot_fullscrape.c') diff --git a/ot_fullscrape.c b/ot_fullscrape.c index 58546ca..3f60d40 100644 --- a/ot_fullscrape.c +++ b/ot_fullscrape.c @@ -152,7 +152,7 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas /* Get exclusive access to that bucket */ ot_vector *torrents_list = mutex_bucket_lock( bucket ); size_t tor_offset; - + /* For each torrent in this bucket.. */ for( tor_offset=0; tor_offsetsize; ++tor_offset ) { /* Address torrents members */ @@ -199,13 +199,13 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas /* Check if there still is enough buffer left */ while( r >= re ) if( fullscrape_increase( iovec_entries, iovector, &r, &re WANT_COMPRESSION_GZIP_PARAM( &strm, mode, Z_NO_FLUSH ) ) ) - return mutex_bucket_unlock( bucket ); + return mutex_bucket_unlock( bucket, 0 ); IF_COMPRESSION( r = compress_buffer; ) } /* All torrents done: release lock on current bucket */ - mutex_bucket_unlock( bucket ); + mutex_bucket_unlock( bucket, 0 ); /* Parent thread died? */ if( !g_opentracker_running ) @@ -225,7 +225,7 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas while( r >= re ) if( fullscrape_increase( iovec_entries, iovector, &r, &re WANT_COMPRESSION_GZIP_PARAM( &strm, mode, Z_FINISH ) ) ) - return mutex_bucket_unlock( bucket ); + return mutex_bucket_unlock( bucket, 0 ); deflateEnd(&strm); } #endif -- cgit v1.2.3