diff options
| author | erdgeist <> | 2008-11-28 22:21:10 +0000 |
|---|---|---|
| committer | erdgeist <> | 2008-11-28 22:21:10 +0000 |
| commit | 334c6e4bbb97a4c0656e1b07c3e6a565f68eae2b (patch) | |
| tree | f84ad28c39b32d0906e32e8ba5e461ecdaed7799 /ot_vector.h | |
| parent | ff6c0339c13a6b42149ba91da14dbb824307cea7 (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.h | 20 |
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 | |||
| 15 | typedef struct { | 18 | typedef 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 | ||
| 21 | void *binary_search( const void * const key, const void * base, const size_t member_count, const size_t member_size, | 24 | void *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 ); |
| 23 | void *vector_find_or_insert( ot_vector *vector, void *key, size_t member_size, size_t compare_size, int *exactmatch ); | 26 | void *vector_find_or_insert( ot_vector *vector, void *key, size_t member_size, size_t compare_size, int *exactmatch ); |
| 24 | 27 | ot_peer *vector_find_or_insert_peer( ot_vector *vector, ot_peer *peer, int *exactmatch ); | |
| 25 | int vector_remove_peer( ot_vector *vector, ot_peer *peer, int hysteresis ); | ||
| 26 | void vector_remove_torrent( ot_vector *vector, ot_torrent *match ); | ||
| 27 | 28 | ||
| 28 | #ifdef _DEBUG_VECTOR | 29 | int vector_remove_peer( ot_vector *vector, ot_peer *peer ); |
| 29 | size_t vector_info( char * reply ); | 30 | void vector_remove_torrent( ot_vector *vector, ot_torrent *match ); |
| 30 | #endif | 31 | void vector_redistribute_buckets( ot_peerlist * peer_list ); |
| 32 | void vector_fixup_peers( ot_vector * vector ); | ||
| 31 | 33 | ||
| 32 | #endif | 34 | #endif |
