Browse Source

Fixed sync loss bug

dynamic-accesslists
erdgeist 14 years ago
parent
commit
3e30fa32aa
  1. 11
      proxy.c

11
proxy.c

@ -606,14 +606,13 @@ static void * streamsync_worker( void * args ) { @@ -606,14 +606,13 @@ static void * streamsync_worker( void * args ) {
case 2: count_two++; break;
case 1: count_one++; break;
case 0: break;
default:
default: count_def++;
count_peers += peer_list->peer_count;
count_def += 1 + ( peer_list->peer_count >> 8 );
}
}
/* Maximal memory requirement: max 3 blocks, max torrents * 20 + max peers * 7 */
mem = 3 * ( 4 + 1 + 1 + 2 ) + ( count_one + count_two ) * 19 + count_def * ( 19 + 6 ) +
mem = 3 * ( 4 + 1 + 1 + 2 ) + ( count_one + count_two ) * 19 + count_def * ( 19 + 8 ) +
( count_one + 2 * count_two + count_peers ) * 7;
fprintf( stderr, "Mem: %zd\n", mem );
@ -781,7 +780,6 @@ static void process_indata( proxy_peer * peer ) { @@ -781,7 +780,6 @@ static void process_indata( proxy_peer * peer ) {
printf( "type: %hhu, prefix: %02X, torrentcount: %zd\n", peer->packet_type, peer->packet_tprefix, peer->packet_tcount );
}
next_torrent:
/* Ensure size for a minimal torrent block */
if( data + sizeof(ot_hash) + OT_IP_SIZE + 3 > dataend ) break;
@ -800,14 +798,11 @@ next_torrent: @@ -800,14 +798,11 @@ next_torrent:
/* Ensure enough data being read to hold all peers */
if( data + (OT_IP_SIZE + 3) * peers > dataend ) break;
printf( "peers: %zd\n", peers );
while( peers-- ) {
livesync_proxytell( peer->packet_tprefix, hash, data );
data += OT_IP_SIZE + 3;
}
if( --peer->packet_tcount )
goto next_torrent;
--peer->packet_tcount;
}
consumed = data - peer->indata;

Loading…
Cancel
Save