From eec51a872c9b08bef1fcd006a8402dfcbf50889e Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Thu, 12 Mar 2009 18:47:02 +0000 Subject: Re-implement logging busy networks to handle v6 API. Implement a state dump for later reparsing. --- ot_fullscrape.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ot_fullscrape.c') diff --git a/ot_fullscrape.c b/ot_fullscrape.c index 4cd0a44..d284bd4 100644 --- a/ot_fullscrape.c +++ b/ot_fullscrape.c @@ -162,14 +162,13 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas switch( mode & TASK_TASK_MASK ) { case TASK_FULLSCRAPE: default: - /* push hash as bencoded string */ *r++='2'; *r++='0'; *r++=':'; memcpy( r, hash, sizeof(ot_hash) ); r += sizeof(ot_hash); /* push rest of the scrape string */ r += sprintf( r, "d8:completei%zde10:downloadedi%zde10:incompletei%zdee", peer_list->seed_count, peer_list->down_count, peer_list->peer_count-peer_list->seed_count ); - break; + break; case TASK_FULLSCRAPE_TPB_ASCII: to_hex( r, *hash ); r+= 2 * sizeof(ot_hash); r += sprintf( r, ":%zd:%zd\n", peer_list->seed_count, peer_list->peer_count-peer_list->seed_count ); @@ -184,6 +183,12 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas r += fmt_urlencoded( r, (char *)*hash, 20 ); r += sprintf( r, ":%zd:%zd\n", peer_list->seed_count, peer_list->peer_count-peer_list->seed_count ); break; + case TASK_FULLSCRAPE_TRACKERSTATE: + memcpy( r, *hash, sizeof(ot_hash) ); r += sizeof(ot_hash); + uint64_pack_big( r, (uint64_t)peer_list->down_count ); + uint64_pack_big( r + 8, (uint64_t)peer_list->base ); + r += 16; + break; } #ifdef WANT_COMPRESSION_GZIP -- cgit v1.2.3