diff options
author | erdgeist <> | 2009-01-02 08:57:53 +0000 |
---|---|---|
committer | erdgeist <> | 2009-01-02 08:57:53 +0000 |
commit | 2df09905f5540fee096d48a92cb0c42558498a12 (patch) | |
tree | 68eab61d29719400972485de395dd0465467aea6 /ot_fullscrape.c | |
parent | 548e2b8338b5ee8d24fa928e833f345bb5cb6f0e (diff) |
* 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.
Diffstat (limited to 'ot_fullscrape.c')
-rw-r--r-- | ot_fullscrape.c | 8 |
1 files changed, 4 insertions, 4 deletions
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 | |||
152 | /* Get exclusive access to that bucket */ | 152 | /* Get exclusive access to that bucket */ |
153 | ot_vector *torrents_list = mutex_bucket_lock( bucket ); | 153 | ot_vector *torrents_list = mutex_bucket_lock( bucket ); |
154 | size_t tor_offset; | 154 | size_t tor_offset; |
155 | 155 | ||
156 | /* For each torrent in this bucket.. */ | 156 | /* For each torrent in this bucket.. */ |
157 | for( tor_offset=0; tor_offset<torrents_list->size; ++tor_offset ) { | 157 | for( tor_offset=0; tor_offset<torrents_list->size; ++tor_offset ) { |
158 | /* Address torrents members */ | 158 | /* Address torrents members */ |
@@ -199,13 +199,13 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas | |||
199 | /* Check if there still is enough buffer left */ | 199 | /* Check if there still is enough buffer left */ |
200 | while( r >= re ) | 200 | while( r >= re ) |
201 | if( fullscrape_increase( iovec_entries, iovector, &r, &re WANT_COMPRESSION_GZIP_PARAM( &strm, mode, Z_NO_FLUSH ) ) ) | 201 | if( fullscrape_increase( iovec_entries, iovector, &r, &re WANT_COMPRESSION_GZIP_PARAM( &strm, mode, Z_NO_FLUSH ) ) ) |
202 | return mutex_bucket_unlock( bucket ); | 202 | return mutex_bucket_unlock( bucket, 0 ); |
203 | 203 | ||
204 | IF_COMPRESSION( r = compress_buffer; ) | 204 | IF_COMPRESSION( r = compress_buffer; ) |
205 | } | 205 | } |
206 | 206 | ||
207 | /* All torrents done: release lock on current bucket */ | 207 | /* All torrents done: release lock on current bucket */ |
208 | mutex_bucket_unlock( bucket ); | 208 | mutex_bucket_unlock( bucket, 0 ); |
209 | 209 | ||
210 | /* Parent thread died? */ | 210 | /* Parent thread died? */ |
211 | if( !g_opentracker_running ) | 211 | if( !g_opentracker_running ) |
@@ -225,7 +225,7 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas | |||
225 | 225 | ||
226 | while( r >= re ) | 226 | while( r >= re ) |
227 | if( fullscrape_increase( iovec_entries, iovector, &r, &re WANT_COMPRESSION_GZIP_PARAM( &strm, mode, Z_FINISH ) ) ) | 227 | if( fullscrape_increase( iovec_entries, iovector, &r, &re WANT_COMPRESSION_GZIP_PARAM( &strm, mode, Z_FINISH ) ) ) |
228 | return mutex_bucket_unlock( bucket ); | 228 | return mutex_bucket_unlock( bucket, 0 ); |
229 | deflateEnd(&strm); | 229 | deflateEnd(&strm); |
230 | } | 230 | } |
231 | #endif | 231 | #endif |