Revision abbef5a5 streaming.c
streaming.c  

297  297 
struct peer *peerps[n]; 
298  298 
struct peer *selectedpeers[selectedpeers_len]; 
299  299  
300 
//reduce load a little bit if there are losses on the path from this guy 

301 
struct nodeID *nodeids[n]; 

302 
double average_lossrate; 

303 
for (i = 0; i<n; i++) nodeids[i] = neighbours[i].id; 

304 
average_lossrate = get_average_lossrate(nodeids, n); 

305 
average_lossrate = finite(average_lossrate) ? average_lossrate : 0; //start agressively, assuming 0 loss 

306 
if (rand()/((double)RAND_MAX + 1) < average_lossrate ) { 

307 
return; 

308 
} 

309  
300  310 
for (i = 0;i < size; i++) chunkps[i] = buff+i; 
301  311 
for (i = 0; i<n; i++) peerps[i] = neighbours+i; 
302  312 
selectPeersForChunks(SCHED_WEIGHTED, peerps, n, chunkps, size, selectedpeers, &selectedpeers_len, needs, peerWeightReceivedfrom); //select a peer that needs at least one of our chunks 
Also available in: Unified diff