summaryrefslogtreecommitdiff
path: root/ot_vector.h
diff options
context:
space:
mode:
authorerdgeist <>2007-11-06 11:58:32 +0000
committererdgeist <>2007-11-06 11:58:32 +0000
commit8900cc0dd980cb08a0af957a1d0dd849bf3c2ac6 (patch)
tree70aeed1dbaceea343e6ebd000d46df025bae21fc /ot_vector.h
parent5749f1d8fe80cbb84d66a265bcf9bafe159985ab (diff)
No one can get access to buckets now without locking them. Also split up the trackerlogic.c-monster in functional sub-units. HEADS UP: this code is untested and not considered stable.
Diffstat (limited to 'ot_vector.h')
-rw-r--r--ot_vector.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/ot_vector.h b/ot_vector.h
new file mode 100644
index 0000000..8863855
--- /dev/null
+++ b/ot_vector.h
@@ -0,0 +1,26 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever. */
3
4#ifndef __OT_VECTOR_H__
5#define __OT_VECTOR_H__
6
7#include "trackerlogic.h"
8
9#define OT_VECTOR_MIN_MEMBERS 4
10#define OT_VECTOR_GROW_RATIO 8
11#define OT_VECTOR_SHRINK_THRESH 6
12#define OT_VECTOR_SHRINK_RATIO 4
13typedef struct {
14 void *data;
15 size_t size;
16 size_t space;
17} ot_vector;
18
19void *binary_search( const void * const key, const void * base, const size_t member_count, const size_t member_size,
20 size_t compare_size, int *exactmatch );
21void *vector_find_or_insert( ot_vector *vector, void *key, size_t member_size, size_t compare_size, int *exactmatch );
22
23int vector_remove_peer( ot_vector *vector, ot_peer *peer, int hysteresis );
24void vector_remove_torrent( ot_vector *vector, ot_torrent *match );
25
26#endif \ No newline at end of file