summaryrefslogtreecommitdiff
path: root/trackerlogic.c
diff options
context:
space:
mode:
Diffstat (limited to 'trackerlogic.c')
-rw-r--r--trackerlogic.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/trackerlogic.c b/trackerlogic.c
index d6a7a33..7d6294d 100644
--- a/trackerlogic.c
+++ b/trackerlogic.c
@@ -164,8 +164,9 @@ static size_t return_peers_all( ot_peerlist *peer_list, char *reply ) {
164 ot_peer * peers = (ot_peer*)bucket_list[bucket].data; 164 ot_peer * peers = (ot_peer*)bucket_list[bucket].data;
165 size_t peer_count = bucket_list[bucket].size; 165 size_t peer_count = bucket_list[bucket].size;
166 while( peer_count-- ) { 166 while( peer_count-- ) {
167 WRITE32(r+=4,0,READ32(peers,0)); 167 WRITE32(r,0,READ32(peers,0));
168 WRITE16(r+=2,0,READ16(peers++,4)); 168 WRITE16(r,4,READ16(peers++,4));
169 r+=6;
169 } 170 }
170 } 171 }
171 172
@@ -208,8 +209,9 @@ static size_t return_peers_selection( ot_peerlist *peer_list, size_t amount, cha
208 bucket_index = ( bucket_index + 1 ) % num_buckets; 209 bucket_index = ( bucket_index + 1 ) % num_buckets;
209 } 210 }
210 peer = ((ot_peer*)bucket_list[bucket_index].data) + bucket_offset; 211 peer = ((ot_peer*)bucket_list[bucket_index].data) + bucket_offset;
211 WRITE32(r+=4,0,READ32(peer,0)); 212 WRITE32(r,0,READ32(peer,0));
212 WRITE16(r+=2,0,READ16(peer,4)); 213 WRITE16(r,4,READ16(peer,4));
214 r+=6;
213 } 215 }
214 return r - reply; 216 return r - reply;
215} 217}
@@ -294,7 +296,7 @@ size_t return_tcp_scrape_for_torrent( ot_hash *hash_list, int amount, char *repl
294 } else { 296 } else {
295 int j; 297 int j;
296 *r++='2';*r++='0';*r++=':'; 298 *r++='2';*r++='0';*r++=':';
297 for(j=0;j<20;j+=4) WRITE32(r+=4,0,READ32(hash,j)); 299 for(j=0;j<20;j+=4) WRITE32(r,j,READ32(hash,j)); r += 20;
298 r += sprintf( r, "d8:completei%zde10:downloadedi%zde10:incompletei%zdee", 300 r += sprintf( r, "d8:completei%zde10:downloadedi%zde10:incompletei%zdee",
299 torrent->peer_list->seed_count, torrent->peer_list->down_count, torrent->peer_list->peer_count-torrent->peer_list->seed_count ); 301 torrent->peer_list->seed_count, torrent->peer_list->down_count, torrent->peer_list->peer_count-torrent->peer_list->seed_count );
300 } 302 }