summaryrefslogtreecommitdiff
path: root/ot_fullscrape.c
diff options
context:
space:
mode:
authorerdgeist <>2009-01-13 22:41:17 +0000
committererdgeist <>2009-01-13 22:41:17 +0000
commit131211b4daf83b7c594337f4e7c71e4711094d71 (patch)
tree63dc942c426103c01d61aa15959a81df91f2d4e1 /ot_fullscrape.c
parent779d6c235ff8fe5284fd10dc82a9b99e7fa38d06 (diff)
V6
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;