aboutsummaryrefslogtreecommitdiff
path: root/src/ats/plugin_ats_proportional.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-08 15:50:13 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-08 15:50:13 +0000
commit386b7d1a0a8b86248e503602b30614b8a3984061 (patch)
tree4daa4fc3055ff5164f47bbe49a2ee606fd71a788 /src/ats/plugin_ats_proportional.c
parentc306f456b0cfdfb55fb28290ff61f7783233cfc3 (diff)
downloadgnunet-386b7d1a0a8b86248e503602b30614b8a3984061.tar.gz
gnunet-386b7d1a0a8b86248e503602b30614b8a3984061.zip
use new 'get_connectivity' API which is also RC-counting, instead of another map
Diffstat (limited to 'src/ats/plugin_ats_proportional.c')
-rw-r--r--src/ats/plugin_ats_proportional.c314
1 files changed, 149 insertions, 165 deletions
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c
index 96ff1a0c0..72508a628 100644
--- a/src/ats/plugin_ats_proportional.c
+++ b/src/ats/plugin_ats_proportional.c
@@ -210,124 +210,143 @@
210 * 210 *
211 */ 211 */
212 212
213/**
214 * FIXME.
215 */
213#define PROPORTIONALITY_FACTOR 2.0 216#define PROPORTIONALITY_FACTOR 2.0
214 217
218
215/** 219/**
216 * A handle for the proportional solver 220 * Wrapper for addresses to store them in a
221 * `struct Network`'s linked list
217 */ 222 */
218struct GAS_PROPORTIONAL_Handle 223struct AddressWrapper
219{ 224{
225 /**
226 * Next in DLL
227 */
228 struct AddressWrapper *next;
220 229
221 /** 230 /**
222 * Our execution environment. 231 * Previous in DLL
223 */ 232 */
224 struct GNUNET_ATS_PluginEnvironment *env; 233 struct AddressWrapper *prev;
225 234
226 /** 235 /**
227 * Hashmap containing all valid addresses 236 * The address
228 */ 237 */
229 struct GNUNET_CONTAINER_MultiPeerMap *addresses; 238 struct ATS_Address *addr;
239};
240
230 241
242/**
243 * Representation of a network
244 */
245struct Network
246{
231 /** 247 /**
232 * Pending address requests 248 * Network description
233 */ 249 */
234 struct GNUNET_CONTAINER_MultiPeerMap *requests; 250 const char *desc;
235 251
236 /** 252 /**
237 * Bulk lock 253 * String for statistics total addresses
238 */ 254 */
239 int bulk_lock; 255 char *stat_total;
240 256
241 /** 257 /**
242 * Number of changes while solver was locked 258 * String for statistics active addresses
243 */ 259 */
244 int bulk_requests; 260 char *stat_active;
245 261
246 /** 262 /**
247 * Total number of addresses for solver 263 * Linked list of addresses in this network: head
248 */ 264 */
249 unsigned int total_addresses; 265 struct AddressWrapper *head;
250 266
251 /** 267 /**
252 * Number of active addresses for solver 268 * Linked list of addresses in this network: tail
253 */ 269 */
254 unsigned int active_addresses; 270 struct AddressWrapper *tail;
255 271
256 /** 272 /**
257 * Networks array 273 * Total inbound quota
258 */ 274 */
259 struct Network *network_entries; 275 unsigned long long total_quota_in;
260 276
261 /** 277 /**
262 * Number of networks 278 * Total outbound quota
263 */ 279 */
264 unsigned int network_count; 280 unsigned long long total_quota_out;
265 281
266 /** 282 /**
267 * Proportionality factor 283 * ATS network type
268 */ 284 */
269 double prop_factor; 285 enum GNUNET_ATS_Network_Type type;
270 286
271 /** 287 /**
272 * Stability factor 288 * Number of active addresses for this network
273 */ 289 */
274 double stability_factor; 290 unsigned int active_addresses;
291
292 /**
293 * Number of total addresses for this network
294 */
295 unsigned int total_addresses;
296
275}; 297};
276 298
299
277/** 300/**
278 * Representation of a network 301 * A handle for the proportional solver
279 */ 302 */
280struct Network 303struct GAS_PROPORTIONAL_Handle
281{ 304{
282 /**
283 * ATS network type
284 */
285 enum GNUNET_ATS_Network_Type type;
286 305
287 /** 306 /**
288 * Network description 307 * Our execution environment.
289 */ 308 */
290 const char *desc; 309 struct GNUNET_ATS_PluginEnvironment *env;
291 310
292 /** 311 /**
293 * Total inbound quota 312 * Networks array
294 */ 313 */
295 unsigned long long total_quota_in; 314 struct Network *network_entries;
296 315
297 /** 316 /**
298 * Total outbound quota 317 * Bulk lock
299 */ 318 */
300 unsigned long long total_quota_out; 319 int bulk_lock;
301 320
302 /** 321 /**
303 * Number of active addresses for this network 322 * Number of changes while solver was locked
304 */ 323 */
305 unsigned int active_addresses; 324 int bulk_requests;
306 325
307 /** 326 /**
308 * Number of total addresses for this network 327 * Total number of addresses for solver
309 */ 328 */
310 unsigned int total_addresses; 329 unsigned int total_addresses;
311 330
312 /** 331 /**
313 * String for statistics total addresses 332 * Number of active addresses for solver
314 */ 333 */
315 char *stat_total; 334 unsigned int active_addresses;
316 335
317 /** 336 /**
318 * String for statistics active addresses 337 * Number of networks in @a network_entries
319 */ 338 */
320 char *stat_active; 339 unsigned int network_count;
321 340
322 /** 341 /**
323 * Linked list of addresses in this network: head 342 * Proportionality factor
324 */ 343 */
325 struct AddressWrapper *head; 344 double prop_factor;
326 345
327 /** 346 /**
328 * Linked list of addresses in this network: tail 347 * Stability factor
329 */ 348 */
330 struct AddressWrapper *tail; 349 double stability_factor;
331}; 350};
332 351
333/** 352/**
@@ -357,27 +376,6 @@ struct AddressSolverInformation
357 376
358}; 377};
359 378
360/**
361 * Wrapper for addresses to store them in network's linked list
362 */
363struct AddressWrapper
364{
365 /**
366 * Next in DLL
367 */
368 struct AddressWrapper *next;
369
370 /**
371 * Previous in DLL
372 */
373 struct AddressWrapper *prev;
374
375 /**
376 * The address
377 */
378 struct ATS_Address *addr;
379};
380
381 379
382/** 380/**
383 * Function used to unload the plugin. 381 * Function used to unload the plugin.
@@ -391,23 +389,25 @@ libgnunet_plugin_ats_proportional_done (void *cls)
391 struct GAS_PROPORTIONAL_Handle *s = sf->cls; 389 struct GAS_PROPORTIONAL_Handle *s = sf->cls;
392 struct AddressWrapper *cur; 390 struct AddressWrapper *cur;
393 struct AddressWrapper *next; 391 struct AddressWrapper *next;
394 int c; 392 unsigned int c;
395 393
396 for (c = 0; c < s->network_count; c++) 394 for (c = 0; c < s->network_count; c++)
397 { 395 {
398 if (s->network_entries[c].total_addresses > 0) 396 if (s->network_entries[c].total_addresses > 0)
399 { 397 {
400 LOG(GNUNET_ERROR_TYPE_DEBUG, 398 LOG (GNUNET_ERROR_TYPE_DEBUG,
401 "Had %u addresses for network `%s' not deleted during shutdown\n", 399 "Had %u addresses for network `%s' not deleted during shutdown\n",
402 s->network_entries[c].total_addresses, s->network_entries[c].desc); 400 s->network_entries[c].total_addresses,
401 s->network_entries[c].desc);
403 //GNUNET_break(0); 402 //GNUNET_break(0);
404 } 403 }
405 404
406 if (s->network_entries[c].active_addresses > 0) 405 if (s->network_entries[c].active_addresses > 0)
407 { 406 {
408 LOG(GNUNET_ERROR_TYPE_DEBUG, 407 LOG (GNUNET_ERROR_TYPE_DEBUG,
409 "Had %u active addresses for network `%s' not deleted during shutdown\n", 408 "Had %u active addresses for network `%s' not deleted during shutdown\n",
410 s->network_entries[c].active_addresses, s->network_entries[c].desc); 409 s->network_entries[c].active_addresses,
410 s->network_entries[c].desc);
411 //GNUNET_break(0); 411 //GNUNET_break(0);
412 } 412 }
413 413
@@ -415,29 +415,30 @@ libgnunet_plugin_ats_proportional_done (void *cls)
415 while (NULL != (cur = next)) 415 while (NULL != (cur = next))
416 { 416 {
417 next = cur->next; 417 next = cur->next;
418 GNUNET_CONTAINER_DLL_remove(s->network_entries[c].head, 418 GNUNET_CONTAINER_DLL_remove (s->network_entries[c].head,
419 s->network_entries[c].tail, cur); 419 s->network_entries[c].tail,
420 cur);
420 GNUNET_free_non_null (cur->addr->solver_information); 421 GNUNET_free_non_null (cur->addr->solver_information);
421 GNUNET_free(cur); 422 GNUNET_free(cur);
422 } 423 }
423 GNUNET_free(s->network_entries[c].stat_total); 424 GNUNET_free (s->network_entries[c].stat_total);
424 GNUNET_free(s->network_entries[c].stat_active); 425 GNUNET_free (s->network_entries[c].stat_active);
425 } 426 }
426 if (s->total_addresses > 0) 427 if (s->total_addresses > 0)
427 { 428 {
428 LOG(GNUNET_ERROR_TYPE_DEBUG, 429 LOG (GNUNET_ERROR_TYPE_DEBUG,
429 "Had %u addresses not deleted during shutdown\n", s->total_addresses); 430 "Had %u addresses not deleted during shutdown\n",
431 s->total_addresses);
430 // GNUNET_break(0); 432 // GNUNET_break(0);
431 } 433 }
432 if (s->active_addresses > 0) 434 if (s->active_addresses > 0)
433 { 435 {
434 LOG(GNUNET_ERROR_TYPE_DEBUG, 436 LOG (GNUNET_ERROR_TYPE_DEBUG,
435 "Had %u active addresses not deleted during shutdown\n", 437 "Had %u active addresses not deleted during shutdown\n",
436 s->active_addresses); 438 s->active_addresses);
437 // GNUNET_break (0); 439 // GNUNET_break (0);
438 } 440 }
439 GNUNET_free (s->network_entries); 441 GNUNET_free (s->network_entries);
440 GNUNET_CONTAINER_multipeermap_destroy (s->requests);
441 GNUNET_free (s); 442 GNUNET_free (s);
442 return NULL; 443 return NULL;
443} 444}
@@ -452,21 +453,23 @@ libgnunet_plugin_ats_proportional_done (void *cls)
452static int 453static int
453is_bandwidth_available_in_network (struct Network *net) 454is_bandwidth_available_in_network (struct Network *net)
454{ 455{
455 GNUNET_assert(NULL != net);
456 unsigned int na = net->active_addresses + 1; 456 unsigned int na = net->active_addresses + 1;
457 uint32_t min_bw = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); 457 uint32_t min_bw = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__);
458
458 if (((net->total_quota_in / na) > min_bw) 459 if (((net->total_quota_in / na) > min_bw)
459 && ((net->total_quota_out / na) > min_bw)) 460 && ((net->total_quota_out / na) > min_bw))
460 { 461 {
461 LOG(GNUNET_ERROR_TYPE_DEBUG, 462 LOG (GNUNET_ERROR_TYPE_DEBUG,
462 "Enough bandwidth available for %u active addresses in network `%s'\n", 463 "Enough bandwidth available for %u active addresses in network `%s'\n",
463 na, net->desc); 464 na,
465 net->desc);
464 466
465 return GNUNET_YES; 467 return GNUNET_YES;
466 } 468 }
467 LOG(GNUNET_ERROR_TYPE_DEBUG, 469 LOG (GNUNET_ERROR_TYPE_DEBUG,
468 "Not enough bandwidth available for %u active addresses in network `%s'\n", 470 "Not enough bandwidth available for %u active addresses in network `%s'\n",
469 na, net->desc); 471 na,
472 net->desc);
470 return GNUNET_NO; 473 return GNUNET_NO;
471} 474}
472 475
@@ -868,7 +871,8 @@ get_active_address (void *solver,
868 static struct ATS_Address *dest; 871 static struct ATS_Address *dest;
869 872
870 dest = NULL; 873 dest = NULL;
871 GNUNET_CONTAINER_multipeermap_get_multiple (addresses, peer, 874 GNUNET_CONTAINER_multipeermap_get_multiple (addresses,
875 peer,
872 &get_active_address_it, 876 &get_active_address_it,
873 &dest); 877 &dest);
874 return dest; 878 return dest;
@@ -1179,7 +1183,7 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s,
1179 1183
1180 /* Find active address */ 1184 /* Find active address */
1181 current_address = get_active_address (s, 1185 current_address = get_active_address (s,
1182 s->addresses, 1186 s->env->addresses,
1183 peer); 1187 peer);
1184 1188
1185 LOG (GNUNET_ERROR_TYPE_INFO, 1189 LOG (GNUNET_ERROR_TYPE_INFO,
@@ -1189,7 +1193,7 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s,
1189 1193
1190 /* Find best address */ 1194 /* Find best address */
1191 best_address = get_best_address (s, 1195 best_address = get_best_address (s,
1192 s->addresses, 1196 s->env->addresses,
1193 peer); 1197 peer);
1194 LOG (GNUNET_ERROR_TYPE_INFO, 1198 LOG (GNUNET_ERROR_TYPE_INFO,
1195 "Peer `%s' has best address %p\n", 1199 "Peer `%s' has best address %p\n",
@@ -1295,12 +1299,15 @@ GAS_proportional_address_change_preference (void *solver,
1295 struct ATS_Address *active_address; 1299 struct ATS_Address *active_address;
1296 struct AddressSolverInformation *asi; 1300 struct AddressSolverInformation *asi;
1297 1301
1298 if (GNUNET_NO == 1302 if (0 ==
1299 GNUNET_CONTAINER_multipeermap_contains (s->requests, peer)) 1303 s->env->get_connectivity (s->env->cls,
1304 peer))
1300 return; /* Peer is not requested */ 1305 return; /* Peer is not requested */
1301 1306
1302 /* This peer is requested, find best address */ 1307 /* This peer is requested, find best address */
1303 active_address = get_active_address (s, s->addresses, peer); 1308 active_address = get_active_address (s,
1309 s->env->addresses,
1310 peer);
1304 best_address = update_active_address (s, peer); 1311 best_address = update_active_address (s, peer);
1305 1312
1306 if ((NULL != best_address) && ((NULL != active_address) && 1313 if ((NULL != best_address) && ((NULL != active_address) &&
@@ -1354,24 +1361,9 @@ GAS_proportional_get_preferred_address (void *solver,
1354 struct GAS_PROPORTIONAL_Handle *s = solver; 1361 struct GAS_PROPORTIONAL_Handle *s = solver;
1355 const struct ATS_Address *best_address; 1362 const struct ATS_Address *best_address;
1356 1363
1357 /* Add to list of pending requests */
1358 if (GNUNET_NO ==
1359 GNUNET_CONTAINER_multipeermap_contains (s->requests, peer))
1360 {
1361 GNUNET_assert (GNUNET_OK ==
1362 GNUNET_CONTAINER_multipeermap_put (s->requests,
1363 peer,
1364 NULL,
1365 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
1366 LOG (GNUNET_ERROR_TYPE_INFO,
1367 "Start suggesting addresses for peer `%s'\n",
1368 GNUNET_i2s (peer));
1369 }
1370
1371 best_address = update_active_address (s, peer); 1364 best_address = update_active_address (s, peer);
1372 if (s->bulk_lock > 0) 1365 if (s->bulk_lock > 0)
1373 return NULL; /* Do not suggest since bulk lock is pending */ 1366 return NULL;
1374
1375 return best_address; 1367 return best_address;
1376} 1368}
1377 1369
@@ -1391,20 +1383,8 @@ GAS_proportional_stop_get_preferred_address (void *solver,
1391 struct AddressSolverInformation *asi; 1383 struct AddressSolverInformation *asi;
1392 struct Network *cur_net; 1384 struct Network *cur_net;
1393 1385
1394 if (GNUNET_YES ==
1395 GNUNET_CONTAINER_multipeermap_contains (s->requests, peer))
1396 {
1397 GNUNET_assert (GNUNET_OK ==
1398 GNUNET_CONTAINER_multipeermap_remove (s->requests,
1399 peer,
1400 NULL));
1401 LOG (GNUNET_ERROR_TYPE_INFO,
1402 "Stop suggesting addresses for peer `%s'\n",
1403 GNUNET_i2s (peer));
1404 }
1405
1406 cur = get_active_address (s, 1386 cur = get_active_address (s,
1407 s->addresses, 1387 s->env->addresses,
1408 peer); 1388 peer);
1409 if (NULL != cur) 1389 if (NULL != cur)
1410 { 1390 {
@@ -1636,16 +1616,22 @@ GAS_proportional_address_property_changed (void *solver,
1636 return; 1616 return;
1637 } 1617 }
1638 1618
1639 LOG(GNUNET_ERROR_TYPE_INFO, 1619 LOG (GNUNET_ERROR_TYPE_INFO,
1640 "Property `%s' for peer `%s' address %p changed to %.2f \n", 1620 "Property `%s' for peer `%s' address %p changed to %.2f \n",
1641 GNUNET_ATS_print_property_type (type), GNUNET_i2s (&address->peer), 1621 GNUNET_ATS_print_property_type (type),
1642 address, rel_value); 1622 GNUNET_i2s (&address->peer),
1643 1623 address,
1644 if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (s->requests, &address->peer)) 1624 rel_value);
1625
1626 if (0 ==
1627 s->env->get_connectivity (s->env->cls,
1628 &address->peer))
1645 return; /* Peer is not requested */ 1629 return; /* Peer is not requested */
1646 1630
1647 /* This peer is requested, find active and best address */ 1631 /* This peer is requested, find active and best address */
1648 active_address = get_active_address(s, s->addresses, &address->peer); 1632 active_address = get_active_address(s,
1633 s->env->addresses,
1634 &address->peer);
1649 best_address = update_active_address (s, 1635 best_address = update_active_address (s,
1650 &address->peer); 1636 &address->peer);
1651 1637
@@ -1693,7 +1679,7 @@ GAS_proportional_address_add (void *solver,
1693 1679
1694 aw = GNUNET_new (struct AddressWrapper); 1680 aw = GNUNET_new (struct AddressWrapper);
1695 aw->addr = address; 1681 aw->addr = address;
1696 GNUNET_CONTAINER_DLL_insert(net->head, net->tail, aw); 1682 GNUNET_CONTAINER_DLL_insert (net->head, net->tail, aw);
1697 address_increment (s, net, GNUNET_YES, GNUNET_NO); 1683 address_increment (s, net, GNUNET_YES, GNUNET_NO);
1698 1684
1699 asi = GNUNET_new (struct AddressSolverInformation); 1685 asi = GNUNET_new (struct AddressSolverInformation);
@@ -1702,19 +1688,25 @@ GAS_proportional_address_add (void *solver,
1702 asi->calculated_quota_out = 0; 1688 asi->calculated_quota_out = 0;
1703 aw->addr->solver_information = asi; 1689 aw->addr->solver_information = asi;
1704 1690
1705 LOG(GNUNET_ERROR_TYPE_INFO, 1691 LOG (GNUNET_ERROR_TYPE_INFO,
1706 "Adding new address %p for peer `%s', now total %u and active %u addresses in network `%s'\n", 1692 "Adding new address %p for peer `%s', now total %u and active %u addresses in network `%s'\n",
1707 address, GNUNET_i2s(&address->peer), net->total_addresses, net->active_addresses, net->desc); 1693 address,
1694 GNUNET_i2s (&address->peer),
1695 net->total_addresses,
1696 net->active_addresses,
1697 net->desc);
1708 1698
1709 if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (s->requests, &address->peer)) 1699 if (0 ==
1700 s->env->get_connectivity (s->env->cls,
1701 &address->peer))
1710 return; /* Peer is not requested */ 1702 return; /* Peer is not requested */
1711 1703
1712 /* This peer is requested, find best address */ 1704 /* This peer is requested, find best address */
1713 update_active_address (s, &address->peer); 1705 update_active_address (s,
1706 &address->peer);
1714} 1707}
1715 1708
1716 1709
1717
1718/** 1710/**
1719 * Function invoked when the plugin is loaded. 1711 * Function invoked when the plugin is loaded.
1720 * 1712 *
@@ -1730,12 +1722,7 @@ libgnunet_plugin_ats_proportional_init (void *cls)
1730 struct GAS_PROPORTIONAL_Handle *s; 1722 struct GAS_PROPORTIONAL_Handle *s;
1731 struct Network * cur; 1723 struct Network * cur;
1732 float f_tmp; 1724 float f_tmp;
1733 int c; 1725 unsigned int c;
1734
1735 GNUNET_assert (NULL != env);
1736 GNUNET_assert (NULL != env->cfg);
1737 GNUNET_assert (NULL != env->bandwidth_changed_cb);
1738 GNUNET_assert (NULL != env->get_preferences);
1739 1726
1740 s = GNUNET_new (struct GAS_PROPORTIONAL_Handle); 1727 s = GNUNET_new (struct GAS_PROPORTIONAL_Handle);
1741 s->env = env; 1728 s->env = env;
@@ -1749,20 +1736,12 @@ libgnunet_plugin_ats_proportional_init (void *cls)
1749 sf.s_del = &GAS_proportional_address_delete; 1736 sf.s_del = &GAS_proportional_address_delete;
1750 sf.s_bulk_start = &GAS_proportional_bulk_start; 1737 sf.s_bulk_start = &GAS_proportional_bulk_start;
1751 sf.s_bulk_stop = &GAS_proportional_bulk_stop; 1738 sf.s_bulk_stop = &GAS_proportional_bulk_stop;
1752
1753 s->network_entries = GNUNET_malloc (env->network_count * sizeof (struct Network));
1754
1755 /* Init */
1756 s->active_addresses = 0;
1757 s->total_addresses = 0;
1758 s->bulk_lock = GNUNET_NO;
1759 s->addresses = env->addresses;
1760 s->requests = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
1761
1762 s->stability_factor = PROP_STABILITY_FACTOR; 1739 s->stability_factor = PROP_STABILITY_FACTOR;
1763 if (GNUNET_SYSERR != 1740 if (GNUNET_SYSERR !=
1764 GNUNET_CONFIGURATION_get_value_float (env->cfg, "ats", 1741 GNUNET_CONFIGURATION_get_value_float (env->cfg,
1765 "PROP_STABILITY_FACTOR", &f_tmp)) 1742 "ats",
1743 "PROP_STABILITY_FACTOR",
1744 &f_tmp))
1766 { 1745 {
1767 if ((f_tmp < 1.0) || (f_tmp > 2.0)) 1746 if ((f_tmp < 1.0) || (f_tmp > 2.0))
1768 { 1747 {
@@ -1776,31 +1755,36 @@ libgnunet_plugin_ats_proportional_init (void *cls)
1776 s->stability_factor = f_tmp; 1755 s->stability_factor = f_tmp;
1777 LOG (GNUNET_ERROR_TYPE_INFO, 1756 LOG (GNUNET_ERROR_TYPE_INFO,
1778 "Using %s of %.3f\n", 1757 "Using %s of %.3f\n",
1779 "PROP_STABILITY_FACTOR", f_tmp); 1758 "PROP_STABILITY_FACTOR",
1759 f_tmp);
1780 } 1760 }
1781 } 1761 }
1782
1783 s->prop_factor = PROPORTIONALITY_FACTOR; 1762 s->prop_factor = PROPORTIONALITY_FACTOR;
1784 if (GNUNET_SYSERR != 1763 if (GNUNET_SYSERR !=
1785 GNUNET_CONFIGURATION_get_value_float (env->cfg, "ats", 1764 GNUNET_CONFIGURATION_get_value_float (env->cfg,
1765 "ats",
1786 "PROP_PROPORTIONALITY_FACTOR", 1766 "PROP_PROPORTIONALITY_FACTOR",
1787 &f_tmp)) 1767 &f_tmp))
1788 { 1768 {
1789 if (f_tmp < 1.0) 1769 if (f_tmp < 1.0)
1790 { 1770 {
1791 LOG (GNUNET_ERROR_TYPE_ERROR, 1771 LOG (GNUNET_ERROR_TYPE_ERROR,
1792 _("Invalid %s configuration %f \n"), 1772 _("Invalid %s configuration %f\n"),
1793 "PROP_PROPORTIONALITY_FACTOR", f_tmp); 1773 "PROP_PROPORTIONALITY_FACTOR",
1774 f_tmp);
1794 } 1775 }
1795 else 1776 else
1796 { 1777 {
1797 s->prop_factor = f_tmp; 1778 s->prop_factor = f_tmp;
1798 LOG (GNUNET_ERROR_TYPE_INFO, 1779 LOG (GNUNET_ERROR_TYPE_INFO,
1799 "Using %s of %.3f\n", 1780 "Using %s of %.3f\n",
1800 "PROP_PROPORTIONALITY_FACTOR", f_tmp); 1781 "PROP_PROPORTIONALITY_FACTOR"
1782 , f_tmp);
1801 } 1783 }
1802 } 1784 }
1803 1785
1786 s->network_entries = GNUNET_malloc (env->network_count *
1787 sizeof (struct Network));
1804 for (c = 0; c < env->network_count; c++) 1788 for (c = 0; c < env->network_count; c++)
1805 { 1789 {
1806 cur = &s->network_entries[c]; 1790 cur = &s->network_entries[c];