summaryrefslogtreecommitdiff
path: root/ot_mutex.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2008-12-08 02:23:21 +0000
committerDirk Engling <erdgeist@erdgeist.org>2008-12-08 02:23:21 +0000
commit343169385e39526bdcb8069f616eb1ab61609241 (patch)
tree28136eb11aa68a2cf0bda7bb81202db15f003043 /ot_mutex.c
parent32edd0dff819137a81b7db3935ca594ede66dae2 (diff)
downloadopentracker-343169385e39526bdcb8069f616eb1ab61609241.tar.gz
opentracker-343169385e39526bdcb8069f616eb1ab61609241.zip
Make all torrents in their buckets sorted again.
Diffstat (limited to 'ot_mutex.c')
-rw-r--r--ot_mutex.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ot_mutex.c b/ot_mutex.c
index 00d0668..4bdd689 100644
--- a/ot_mutex.c
+++ b/ot_mutex.c
@@ -80,7 +80,7 @@ ot_vector *mutex_bucket_lock( int bucket ) {
}
ot_vector *mutex_bucket_lock_by_hash( ot_hash *hash ) {
- int bucket = uint32_read( *hash ) % OT_BUCKET_COUNT;
+ int bucket = uint32_read_big( (char*)*hash ) >> OT_BUCKET_COUNT_SHIFT;
/* Can block */
mutex_bucket_lock( bucket );
@@ -95,7 +95,7 @@ void mutex_bucket_unlock( int bucket ) {
}
void mutex_bucket_unlock_by_hash( ot_hash *hash ) {
- mutex_bucket_unlock( uint32_read( *hash ) % OT_BUCKET_COUNT );
+ mutex_bucket_unlock( uint32_read_big( (char*)*hash ) >> OT_BUCKET_COUNT_SHIFT );
}
/* TaskQueue Magic */
@@ -316,4 +316,4 @@ void mutex_deinit( ) {
byte_zero( all_torrents, sizeof( all_torrents ) );
}
-const char *g_version_mutex_c = "$Source: /home/cvsroot/opentracker/ot_mutex.c,v $: $Revision: 1.14 $\n";
+const char *g_version_mutex_c = "$Source: /home/cvsroot/opentracker/ot_mutex.c,v $: $Revision: 1.15 $\n";