diff options
author | erdgeist <> | 2008-12-07 13:14:24 +0000 |
---|---|---|
committer | erdgeist <> | 2008-12-07 13:14:24 +0000 |
commit | bca8bee62334de23fdb28ae5a8fa76b5d72089cb (patch) | |
tree | 06bab06dd505faf4df9851b42721c664a06d89b2 /trackerlogic.c | |
parent | 5f5007883e17b6f030d34b2b7d813426df73505a (diff) |
Fix: auto increment in += is not a post increment...
Diffstat (limited to 'trackerlogic.c')
-rw-r--r-- | trackerlogic.c | 12 |
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 | } |