diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-04-16 14:53:40 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-04-16 14:53:40 +0000 |
commit | 21d0e9ff2c7538d455ecc300dd306964ea1c9a1a (patch) | |
tree | d45e5af9de23cfe67aaa653e1ce13fc876e4f5f9 /src/ats/plugin_ats_proportional.c | |
parent | 42718fec475b1cef0f1db021c21e0dad08eec8c6 (diff) | |
download | gnunet-21d0e9ff2c7538d455ecc300dd306964ea1c9a1a.tar.gz gnunet-21d0e9ff2c7538d455ecc300dd306964ea1c9a1a.zip |
fixes to adding addresses
Diffstat (limited to 'src/ats/plugin_ats_proportional.c')
-rw-r--r-- | src/ats/plugin_ats_proportional.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c index 03164f7ec..bf978ad37 100644 --- a/src/ats/plugin_ats_proportional.c +++ b/src/ats/plugin_ats_proportional.c | |||
@@ -736,6 +736,12 @@ find_best_address_it (void *cls, | |||
736 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (now, current->blocked_until), GNUNET_YES)); | 736 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (now, current->blocked_until), GNUNET_YES)); |
737 | return GNUNET_OK; | 737 | return GNUNET_OK; |
738 | } | 738 | } |
739 | if (NULL == asi) | ||
740 | { | ||
741 | GNUNET_break (0); | ||
742 | return GNUNET_OK; | ||
743 | } | ||
744 | |||
739 | if (GNUNET_NO == is_bandwidth_available_in_network (asi->network)) | 745 | if (GNUNET_NO == is_bandwidth_available_in_network (asi->network)) |
740 | return GNUNET_OK; /* There's no bandwidth available in this network */ | 746 | return GNUNET_OK; /* There's no bandwidth available in this network */ |
741 | 747 | ||
@@ -902,6 +908,7 @@ get_network (struct GAS_PROPORTIONAL_Handle *s, uint32_t type) | |||
902 | int c; | 908 | int c; |
903 | for (c = 0; c < s->network_count; c++) | 909 | for (c = 0; c < s->network_count; c++) |
904 | { | 910 | { |
911 | fprintf (stderr, "%u == %u \n", s->network_entries[c].type,type); | ||
905 | if (s->network_entries[c].type == type) | 912 | if (s->network_entries[c].type == type) |
906 | return &s->network_entries[c]; | 913 | return &s->network_entries[c]; |
907 | } | 914 | } |
@@ -1394,6 +1401,12 @@ GAS_proportional_address_property_changed (void *solver, | |||
1394 | 1401 | ||
1395 | s = (struct GAS_PROPORTIONAL_Handle *) solver; | 1402 | s = (struct GAS_PROPORTIONAL_Handle *) solver; |
1396 | asi = address->solver_information; | 1403 | asi = address->solver_information; |
1404 | if (NULL == asi) | ||
1405 | { | ||
1406 | GNUNET_break(0); | ||
1407 | return; | ||
1408 | } | ||
1409 | |||
1397 | n = asi->network; | 1410 | n = asi->network; |
1398 | 1411 | ||
1399 | if (NULL == n) | 1412 | if (NULL == n) |
@@ -1486,6 +1499,14 @@ GAS_proportional_address_change_network (void *solver, | |||
1486 | return; | 1499 | return; |
1487 | } | 1500 | } |
1488 | 1501 | ||
1502 | asi = address->solver_information; | ||
1503 | if (NULL == asi) | ||
1504 | { | ||
1505 | GNUNET_break(0); | ||
1506 | return; | ||
1507 | } | ||
1508 | |||
1509 | |||
1489 | /* Network changed */ | 1510 | /* Network changed */ |
1490 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 1511 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
1491 | "Network type changed, moving %s address from `%s' to `%s'\n", | 1512 | "Network type changed, moving %s address from `%s' to `%s'\n", |
@@ -1521,7 +1542,6 @@ GAS_proportional_address_change_network (void *solver, | |||
1521 | } | 1542 | } |
1522 | 1543 | ||
1523 | /* Add to new network and update*/ | 1544 | /* Add to new network and update*/ |
1524 | asi = address->solver_information; | ||
1525 | asi->network = new_net; | 1545 | asi->network = new_net; |
1526 | GAS_proportional_address_add (solver, address, new_network); | 1546 | GAS_proportional_address_add (solver, address, new_network); |
1527 | if (GNUNET_YES == save_active) | 1547 | if (GNUNET_YES == save_active) |
@@ -1569,6 +1589,12 @@ GAS_proportional_address_add (void *solver, struct ATS_Address *address, | |||
1569 | if (NULL == net) | 1589 | if (NULL == net) |
1570 | { | 1590 | { |
1571 | GNUNET_break(0); | 1591 | GNUNET_break(0); |
1592 | |||
1593 | LOG(GNUNET_ERROR_TYPE_ERROR, | ||
1594 | "Unknown network %u `%s' for new address %p for peer `%s'\n", | ||
1595 | network, GNUNET_ATS_print_network_type(network), | ||
1596 | address, GNUNET_i2s(&address->peer)); | ||
1597 | |||
1572 | return; | 1598 | return; |
1573 | } | 1599 | } |
1574 | 1600 | ||