summaryrefslogtreecommitdiff
path: root/ot_vector.h
diff options
context:
space:
mode:
authorerdgeist <>2008-11-28 22:21:10 +0000
committererdgeist <>2008-11-28 22:21:10 +0000
commit334c6e4bbb97a4c0656e1b07c3e6a565f68eae2b (patch)
treef84ad28c39b32d0906e32e8ba5e461ecdaed7799 /ot_vector.h
parentff6c0339c13a6b42149ba91da14dbb824307cea7 (diff)
The BIG refactoring [tm]. Too many changes to count them. If it doesn't suite you, revert to last version.
Diffstat (limited to 'ot_vector.h')
-rw-r--r--ot_vector.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/ot_vector.h b/ot_vector.h
index 1d42dd0..37135e7 100644
--- a/ot_vector.h
+++ b/ot_vector.h
@@ -12,21 +12,23 @@
12#define OT_VECTOR_SHRINK_THRESH 4 12#define OT_VECTOR_SHRINK_THRESH 4
13#define OT_VECTOR_SHRINK_RATIO 2 13#define OT_VECTOR_SHRINK_RATIO 2
14 14
15#define OT_PEER_BUCKET_MINCOUNT 512
16#define OT_PEER_BUCKET_MAXCOUNT 256
17
15typedef struct { 18typedef struct {
16 void *data; 19 void *data;
17 size_t size; 20 size_t size;
18 size_t space; 21 size_t space;
19} ot_vector; 22} ot_vector;
20 23
21void *binary_search( const void * const key, const void * base, const size_t member_count, const size_t member_size, 24void *binary_search( const void * const key, const void * base, const size_t member_count, const size_t member_size,
22 size_t compare_size, int *exactmatch ); 25 size_t compare_size, int *exactmatch );
23void *vector_find_or_insert( ot_vector *vector, void *key, size_t member_size, size_t compare_size, int *exactmatch ); 26void *vector_find_or_insert( ot_vector *vector, void *key, size_t member_size, size_t compare_size, int *exactmatch );
24 27ot_peer *vector_find_or_insert_peer( ot_vector *vector, ot_peer *peer, int *exactmatch );
25int vector_remove_peer( ot_vector *vector, ot_peer *peer, int hysteresis );
26void vector_remove_torrent( ot_vector *vector, ot_torrent *match );
27 28
28#ifdef _DEBUG_VECTOR 29int vector_remove_peer( ot_vector *vector, ot_peer *peer );
29size_t vector_info( char * reply ); 30void vector_remove_torrent( ot_vector *vector, ot_torrent *match );
30#endif 31void vector_redistribute_buckets( ot_peerlist * peer_list );
32void vector_fixup_peers( ot_vector * vector );
31 33
32#endif 34#endif