summaryrefslogtreecommitdiff
path: root/src/ot_stats.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ot_stats.c')
-rw-r--r--src/ot_stats.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ot_stats.c b/src/ot_stats.c
index 9e2eabe..0e2fc67 100644
--- a/src/ot_stats.c
+++ b/src/ot_stats.c
@@ -243,15 +243,15 @@ static void stats_slash24s_txt(char **reply, const char *reply_end, size_t amoun
243 for (bucket = 0; bucket < OT_BUCKET_COUNT; ++bucket) { 243 for (bucket = 0; bucket < OT_BUCKET_COUNT; ++bucket) {
244 ot_vector *torrents_list = mutex_bucket_lock(bucket); 244 ot_vector *torrents_list = mutex_bucket_lock(bucket);
245 for (i = 0; i < torrents_list->size; ++i) { 245 for (i = 0; i < torrents_list->size; ++i) {
246 ot_peerlist *peer_list = (((ot_torrent *)(torrents_list->data))[i]).peer_list4; 246 ot_peerlist *peer_list = (((ot_torrent *)(torrents_list->data))[i]).peer_list;
247 ot_vector *bucket_list; 247 ot_vector *bucket_list;
248 int num_buckets = 1; 248 int num_buckets = 1;
249 249
250 if (!peer_list) 250 if (!peer_list)
251 continue; 251 continue;
252 bucket_list = &peer_list->peers; 252 bucket_list = &peer_list->peers4; /* /24 networks are an IPv4 notion */
253 253
254 if (OT_PEERLIST_HASBUCKETS(peer_list)) { 254 if (OT_VECTOR_HASBUCKETS(bucket_list)) {
255 num_buckets = bucket_list->size; 255 num_buckets = bucket_list->size;
256 bucket_list = (ot_vector *)bucket_list->data; 256 bucket_list = (ot_vector *)bucket_list->data;
257 } 257 }
@@ -303,8 +303,8 @@ typedef struct {
303static int torrent_statter(ot_torrent *torrent, uintptr_t data) { 303static int torrent_statter(ot_torrent *torrent, uintptr_t data) {
304 torrent_stats *stats = (torrent_stats *)data; 304 torrent_stats *stats = (torrent_stats *)data;
305 stats->torrent_count++; 305 stats->torrent_count++;
306 stats->peer_count += peerlist_peer_count(torrent->peer_list6) + peerlist_peer_count(torrent->peer_list4); 306 stats->peer_count += torrent_peer_count(torrent);
307 stats->seed_count += peerlist_seed_count(torrent->peer_list6) + peerlist_seed_count(torrent->peer_list4); 307 stats->seed_count += torrent_seed_count(torrent);
308 return 0; 308 return 0;
309} 309}
310 310
@@ -347,8 +347,8 @@ void stats_top_txt(char **reply, const char *reply_end, size_t amount) {
347 ot_vector *torrents_list = mutex_bucket_lock(bucket); 347 ot_vector *torrents_list = mutex_bucket_lock(bucket);
348 for (j = 0; j < torrents_list->size; ++j) { 348 for (j = 0; j < torrents_list->size; ++j) {
349 ot_torrent *torrent = (ot_torrent *)(torrents_list->data) + j; 349 ot_torrent *torrent = (ot_torrent *)(torrents_list->data) + j;
350 size_t peer_count = peerlist_peer_count(torrent->peer_list6) + peerlist_peer_count(torrent->peer_list4); 350 size_t peer_count = torrent_peer_count(torrent);
351 size_t seed_count = peerlist_seed_count(torrent->peer_list6) + peerlist_seed_count(torrent->peer_list4); 351 size_t seed_count = torrent_seed_count(torrent);
352 size_t leech_count = peer_count - seed_count; 352 size_t leech_count = peer_count - seed_count;
353 353
354 stats_insert_into_highscore(peer_count, top100c, amount, &torrent->hash); 354 stats_insert_into_highscore(peer_count, top100c, amount, &torrent->hash);