Revision 9818ca86 topology.c
topology.c  

29  29  
30  30 
#define MIN(A,B) ((A) < (B)) ? (A) : (B) 
31  31  
32 
double desired_bw = 0; 

32  33 
double desired_rtt = 0.2; 
33  34 
double alpha_target = 0.5; 
34  35  
...  ...  
186  187 
#endif 
187  188 
} 
188  189  
190 
//get the declared capacity of a node 

191 
static double get_capacity_of(const struct nodeID* n){ 

192 
struct peer *p = peerset_get_peer(pset, n); 

193 
if (p) { 

194 
return p>capacity; 

195 
} 

196  
197 
return NAN; 

198 
} 

199  
189  200 
//returns: 1:yes 0:no 1:unknown 
190  201 
int desiredness(const struct nodeID* n) { 
191  202 
double rtt = get_rtt_of(n); 
203 
double bw = get_capacity_of(n); 

204  
205 
if ((isnan(rtt) && finite(desired_rtt))  (isnan(bw) && desired_bw > 0)) { 

206 
return 1; 

207 
} else if ((isnan(rtt)  rtt <= desired_rtt) && (isnan(bw)  bw >= desired_bw)) { 

208 
return 1; 

209 
} 

192  210  
193 
return isnan(rtt) ? 1 : ((rtt <= desired_rtt) ? 1 : 0);


211 
return 0;


194  212 
} 
195  213  
196  214 
bool is_desired(const struct nodeID* n) { 
Also available in: Unified diff