summaryrefslogtreecommitdiff
path: root/ot_fullscrape.c
diff options
context:
space:
mode:
Diffstat (limited to 'ot_fullscrape.c')
-rw-r--r--ot_fullscrape.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ot_fullscrape.c b/ot_fullscrape.c
index 3f60d40..17405b7 100644
--- a/ot_fullscrape.c
+++ b/ot_fullscrape.c
@@ -115,7 +115,7 @@ static int fullscrape_increase( int *iovec_entries, struct iovec **iovector,
115} 115}
116 116
117static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tasktype mode ) { 117static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tasktype mode ) {
118 int bucket,i; 118 int bucket;
119 char *r, *re; 119 char *r, *re;
120#ifdef WANT_COMPRESSION_GZIP 120#ifdef WANT_COMPRESSION_GZIP
121 char compress_buffer[OT_SCRAPE_MAXENTRYLEN]; 121 char compress_buffer[OT_SCRAPE_MAXENTRYLEN];
@@ -165,17 +165,17 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas
165 165
166 /* push hash as bencoded string */ 166 /* push hash as bencoded string */
167 *r++='2'; *r++='0'; *r++=':'; 167 *r++='2'; *r++='0'; *r++=':';
168 for(i=0;i<20;i+=4) WRITE32(r,i,READ32(hash,i)); r+=20; 168 memcpy( r, hash, sizeof(ot_hash) ); r += sizeof(ot_hash);
169 /* push rest of the scrape string */ 169 /* push rest of the scrape string */
170 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 ); 170 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 );
171 171
172 break; 172 break;
173 case TASK_FULLSCRAPE_TPB_ASCII: 173 case TASK_FULLSCRAPE_TPB_ASCII:
174 to_hex( r, *hash ); r+=40; 174 to_hex( r, *hash ); r+= 2 * sizeof(ot_hash);
175 r += sprintf( r, ":%zd:%zd\n", peer_list->seed_count, peer_list->peer_count-peer_list->seed_count ); 175 r += sprintf( r, ":%zd:%zd\n", peer_list->seed_count, peer_list->peer_count-peer_list->seed_count );
176 break; 176 break;
177 case TASK_FULLSCRAPE_TPB_BINARY: 177 case TASK_FULLSCRAPE_TPB_BINARY:
178 for(i=0;i<20;i+=4) WRITE32(r,i,READ32(hash,i)); r+=20; 178 memcpy( r, *hash, sizeof(ot_hash) ); r += sizeof(ot_hash);
179 *(uint32_t*)(r+0) = htonl( (uint32_t) peer_list->seed_count ); 179 *(uint32_t*)(r+0) = htonl( (uint32_t) peer_list->seed_count );
180 *(uint32_t*)(r+4) = htonl( (uint32_t)( peer_list->peer_count-peer_list->seed_count) ); 180 *(uint32_t*)(r+4) = htonl( (uint32_t)( peer_list->peer_count-peer_list->seed_count) );
181 r+=8; 181 r+=8;