summaryrefslogtreecommitdiff
path: root/src/trackerlogic.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/trackerlogic.h')
-rw-r--r--src/trackerlogic.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/trackerlogic.h b/src/trackerlogic.h
index 241b6a7..6b53406 100644
--- a/src/trackerlogic.h
+++ b/src/trackerlogic.h
@@ -165,17 +165,17 @@ struct ot_peerlist;
165typedef struct ot_peerlist ot_peerlist; 165typedef struct ot_peerlist ot_peerlist;
166typedef struct { 166typedef struct {
167 ot_hash hash; 167 ot_hash hash;
168 ot_peerlist *peer_list6; 168 ot_peerlist *peer_list6; /* NULL until the torrent has a v6 peer */
169 ot_peerlist *peer_list4; 169 ot_peerlist *peer_list4; /* NULL until the torrent has a v4 peer */
170 uint32_t base; /* minutes, when the torrent was last cleaned */
171 uint32_t down_count; /* completed events, summed over both families */
170} ot_torrent; 172} ot_torrent;
171 173
172#include "ot_vector.h" 174#include "ot_vector.h"
173 175
174struct ot_peerlist { 176struct ot_peerlist {
175 ot_time base; 177 uint32_t seed_count;
176 size_t seed_count; 178 uint32_t peer_count;
177 size_t peer_count;
178 size_t down_count;
179 /* normal peers vector or 179 /* normal peers vector or
180 pointer to ot_vector[32] buckets if data != NULL and space == 0 180 pointer to ot_vector[32] buckets if data != NULL and space == 0
181 */ 181 */
@@ -183,6 +183,9 @@ struct ot_peerlist {
183}; 183};
184#define OT_PEERLIST_HASBUCKETS(peer_list) ((peer_list)->peers.size > (peer_list)->peers.space) 184#define OT_PEERLIST_HASBUCKETS(peer_list) ((peer_list)->peers.size > (peer_list)->peers.space)
185 185
186static inline uint32_t peerlist_peer_count(const ot_peerlist *peer_list) { return peer_list ? peer_list->peer_count : 0; }
187static inline uint32_t peerlist_seed_count(const ot_peerlist *peer_list) { return peer_list ? peer_list->seed_count : 0; }
188
186/* The http replies the tracker counts when it has to refuse a request. */ 189/* The http replies the tracker counts when it has to refuse a request. */
187enum { 190enum {
188 CODE_HTTPERROR_302, 191 CODE_HTTPERROR_302,