diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-11-07 11:51:13 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-11-07 11:51:13 +0000 |
commit | 7e8ac7c7ed2b81b66b77d2162db667e1e24269e7 (patch) | |
tree | 0249f09a8809d07d67dd8d743735c237434e89e2 /src/ats | |
parent | 6aa2127441cd5605b5823753f1ee735aaa0a3f52 (diff) | |
download | gnunet-7e8ac7c7ed2b81b66b77d2162db667e1e24269e7.tar.gz gnunet-7e8ac7c7ed2b81b66b77d2162db667e1e24269e7.zip |
splitting up calculation and notification for proportional solver to ensure measurement correctness
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 1 | ||||
-rw-r--r-- | src/ats/libgnunet_plugin_ats_proportional.c | 144 |
2 files changed, 110 insertions, 35 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index 554c351e4..d10eff479 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -1742,6 +1742,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1742 | GNUNET_assert(NULL != ah->addresses); | 1742 | GNUNET_assert(NULL != ah->addresses); |
1743 | 1743 | ||
1744 | /* Figure out configured solution method */ | 1744 | /* Figure out configured solution method */ |
1745 | plugin_short = NULL; | ||
1745 | if (GNUNET_SYSERR | 1746 | if (GNUNET_SYSERR |
1746 | == GNUNET_CONFIGURATION_get_value_string (cfg, "ats", "MODE", &mode_str)) | 1747 | == GNUNET_CONFIGURATION_get_value_string (cfg, "ats", "MODE", &mode_str)) |
1747 | { | 1748 | { |
diff --git a/src/ats/libgnunet_plugin_ats_proportional.c b/src/ats/libgnunet_plugin_ats_proportional.c index 0cbf2d26a..a073181e5 100644 --- a/src/ats/libgnunet_plugin_ats_proportional.c +++ b/src/ats/libgnunet_plugin_ats_proportional.c | |||
@@ -346,6 +346,28 @@ struct Network | |||
346 | }; | 346 | }; |
347 | 347 | ||
348 | /** | 348 | /** |
349 | * Address information stored in the solver | ||
350 | */ | ||
351 | struct AddressSolverInformation | ||
352 | { | ||
353 | struct Network *network; | ||
354 | |||
355 | /** | ||
356 | * Inbound quota | ||
357 | * | ||
358 | */ | ||
359 | unsigned long long calculated_quota_in_NBO; | ||
360 | |||
361 | /** | ||
362 | * Outbound quota | ||
363 | * | ||
364 | */ | ||
365 | unsigned long long calculated_quota_out_NBO; | ||
366 | |||
367 | |||
368 | }; | ||
369 | |||
370 | /** | ||
349 | * Wrapper for addresses to store them in network's linked list | 371 | * Wrapper for addresses to store them in network's linked list |
350 | */ | 372 | */ |
351 | struct AddressWrapper | 373 | struct AddressWrapper |
@@ -533,9 +555,11 @@ static void | |||
533 | distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s, | 555 | distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s, |
534 | struct Network *net, struct ATS_Address *address_except) | 556 | struct Network *net, struct ATS_Address *address_except) |
535 | { | 557 | { |
558 | struct AddressSolverInformation *asi; | ||
559 | struct AddressWrapper *cur; | ||
560 | |||
536 | unsigned long long remaining_quota_in = 0; | 561 | unsigned long long remaining_quota_in = 0; |
537 | unsigned long long quota_out_used = 0; | 562 | unsigned long long quota_out_used = 0; |
538 | |||
539 | unsigned long long remaining_quota_out = 0; | 563 | unsigned long long remaining_quota_out = 0; |
540 | unsigned long long quota_in_used = 0; | 564 | unsigned long long quota_in_used = 0; |
541 | uint32_t min_bw = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); | 565 | uint32_t min_bw = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); |
@@ -544,10 +568,9 @@ distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s, | |||
544 | double cur_pref; /* Important: has to be double not float due to precision */ | 568 | double cur_pref; /* Important: has to be double not float due to precision */ |
545 | const double *t = NULL; /* Important: has to be double not float due to precision */ | 569 | const double *t = NULL; /* Important: has to be double not float due to precision */ |
546 | int c; | 570 | int c; |
547 | |||
548 | unsigned long long assigned_quota_in = 0; | 571 | unsigned long long assigned_quota_in = 0; |
549 | unsigned long long assigned_quota_out = 0; | 572 | unsigned long long assigned_quota_out = 0; |
550 | struct AddressWrapper *cur; | 573 | |
551 | 574 | ||
552 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 575 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
553 | "Recalculate quota for network type `%s' for %u addresses (in/out): %llu/%llu \n", | 576 | "Recalculate quota for network type `%s' for %u addresses (in/out): %llu/%llu \n", |
@@ -637,16 +660,9 @@ distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s, | |||
637 | assigned_quota_out = UINT32_MAX; | 660 | assigned_quota_out = UINT32_MAX; |
638 | 661 | ||
639 | /* Compare to current bandwidth assigned */ | 662 | /* Compare to current bandwidth assigned */ |
640 | if ((assigned_quota_in != ntohl (cur->addr->assigned_bw_in.value__)) | 663 | asi = cur->addr->solver_information; |
641 | || (assigned_quota_out != ntohl (cur->addr->assigned_bw_out.value__))) | 664 | asi->calculated_quota_in_NBO = htonl (assigned_quota_in); |
642 | { | 665 | asi->calculated_quota_out_NBO = htonl (assigned_quota_out); |
643 | cur->addr->assigned_bw_in.value__ = htonl (assigned_quota_in); | ||
644 | cur->addr->assigned_bw_out.value__ = htonl (assigned_quota_out); | ||
645 | /* Notify on change */ | ||
646 | if ((GNUNET_YES == cur->addr->active) && (cur->addr != address_except)) | ||
647 | s->bw_changed (s->bw_changed_cls, cur->addr); | ||
648 | } | ||
649 | |||
650 | } | 666 | } |
651 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 667 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
652 | "Total bandwidth assigned is (in/out): %llu /%llu\n", quota_in_used, | 668 | "Total bandwidth assigned is (in/out): %llu /%llu\n", quota_in_used, |
@@ -700,11 +716,12 @@ find_best_address_it (void *cls, | |||
700 | struct FindBestAddressCtx *fba_ctx = (struct FindBestAddressCtx *) cls; | 716 | struct FindBestAddressCtx *fba_ctx = (struct FindBestAddressCtx *) cls; |
701 | struct ATS_Address *current = (struct ATS_Address *) value; | 717 | struct ATS_Address *current = (struct ATS_Address *) value; |
702 | struct GNUNET_TIME_Absolute now; | 718 | struct GNUNET_TIME_Absolute now; |
703 | struct Network *net = (struct Network *) current->solver_information; | 719 | struct AddressSolverInformation *asi; |
704 | const double *norm_prop_cur; | 720 | const double *norm_prop_cur; |
705 | const double *norm_prop_prev; | 721 | const double *norm_prop_prev; |
706 | int index; | 722 | int index; |
707 | 723 | ||
724 | asi = current->solver_information; | ||
708 | now = GNUNET_TIME_absolute_get (); | 725 | now = GNUNET_TIME_absolute_get (); |
709 | 726 | ||
710 | if (current->blocked_until.abs_value_us | 727 | if (current->blocked_until.abs_value_us |
@@ -716,7 +733,7 @@ find_best_address_it (void *cls, | |||
716 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (now, current->blocked_until), GNUNET_YES)); | 733 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (now, current->blocked_until), GNUNET_YES)); |
717 | return GNUNET_OK; | 734 | return GNUNET_OK; |
718 | } | 735 | } |
719 | if (GNUNET_NO == is_bandwidth_available_in_network (net)) | 736 | if (GNUNET_NO == is_bandwidth_available_in_network (asi->network)) |
720 | return GNUNET_OK; /* There's no bandwidth available in this network */ | 737 | return GNUNET_OK; /* There's no bandwidth available in this network */ |
721 | if (NULL != fba_ctx->best) | 738 | if (NULL != fba_ctx->best) |
722 | { | 739 | { |
@@ -795,6 +812,26 @@ find_best_address_it (void *cls, | |||
795 | * Helper functions | 812 | * Helper functions |
796 | * --------------------------- | 813 | * --------------------------- |
797 | */ | 814 | */ |
815 | static void | ||
816 | propagate_bandwidth (struct GAS_PROPORTIONAL_Handle *s, | ||
817 | struct Network *net, struct ATS_Address *address_except) | ||
818 | { | ||
819 | struct AddressWrapper *cur; | ||
820 | struct AddressSolverInformation *asi; | ||
821 | for (cur = net->head; NULL != cur; cur = cur->next) | ||
822 | { | ||
823 | asi = cur->addr->solver_information; | ||
824 | if ( (cur->addr->assigned_bw_in.value__ != asi->calculated_quota_in_NBO) || | ||
825 | (cur->addr->assigned_bw_out.value__ != asi->calculated_quota_out_NBO) ) | ||
826 | { | ||
827 | cur->addr->assigned_bw_in.value__ = asi->calculated_quota_in_NBO; | ||
828 | cur->addr->assigned_bw_out.value__ = asi->calculated_quota_in_NBO; | ||
829 | /* Notify on change */ | ||
830 | if ((GNUNET_YES == cur->addr->active) && (cur->addr != address_except)) | ||
831 | s->bw_changed (s->bw_changed_cls, cur->addr); | ||
832 | } | ||
833 | } | ||
834 | } | ||
798 | 835 | ||
799 | /** | 836 | /** |
800 | * Distribibute bandwidth | 837 | * Distribibute bandwidth |
@@ -803,10 +840,9 @@ find_best_address_it (void *cls, | |||
803 | * @param n the network, can be NULL for all network | 840 | * @param n the network, can be NULL for all network |
804 | * @param address_except do not notify for this address | 841 | * @param address_except do not notify for this address |
805 | */ | 842 | */ |
806 | 843 | static void | |
807 | static void distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, | 844 | distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, |
808 | struct Network *n, | 845 | struct Network *n, struct ATS_Address *address_except) |
809 | struct ATS_Address *address_except) | ||
810 | { | 846 | { |
811 | if (GNUNET_YES == s->bulk_lock) | 847 | if (GNUNET_YES == s->bulk_lock) |
812 | { | 848 | { |
@@ -817,22 +853,42 @@ static void distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, | |||
817 | if (NULL != n) | 853 | if (NULL != n) |
818 | { | 854 | { |
819 | if (NULL != s->env->info_cb) | 855 | if (NULL != s->env->info_cb) |
820 | s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE); | 856 | s->env->info_cb(s->env->info_cb_cls, GAS_OP_SOLVE_START, |
821 | distribute_bandwidth (s, n, address_except); | 857 | GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE); |
858 | distribute_bandwidth(s, n, address_except); | ||
859 | if (NULL != s->env->info_cb) | ||
860 | s->env->info_cb(s->env->info_cb_cls, GAS_OP_SOLVE_STOP, | ||
861 | GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE); | ||
822 | if (NULL != s->env->info_cb) | 862 | if (NULL != s->env->info_cb) |
823 | s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE); | 863 | s->env->info_cb(s->env->info_cb_cls, GAS_OP_SOLVE_UPDATE_NOTIFICATION_START, |
864 | GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE); | ||
865 | propagate_bandwidth(s, n, address_except); | ||
866 | if (NULL != s->env->info_cb) | ||
867 | s->env->info_cb(s->env->info_cb_cls, GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP, | ||
868 | GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE); | ||
824 | } | 869 | } |
825 | else | 870 | else |
826 | { | 871 | { |
827 | int i; | 872 | int i; |
828 | if (NULL != s->env->info_cb) | 873 | if (NULL != s->env->info_cb) |
829 | s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL); | 874 | s->env->info_cb(s->env->info_cb_cls, GAS_OP_SOLVE_START, |
875 | GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL); | ||
830 | for (i = 0; i < s->network_count; i++) | 876 | for (i = 0; i < s->network_count; i++) |
831 | distribute_bandwidth (s, &s->network_entries[i], NULL ); | 877 | distribute_bandwidth(s, &s->network_entries[i], NULL); |
832 | if (NULL != s->env->info_cb) | 878 | if (NULL != s->env->info_cb) |
833 | s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL); | 879 | s->env->info_cb(s->env->info_cb_cls, GAS_OP_SOLVE_STOP, |
880 | GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL); | ||
881 | for (i = 0; i < s->network_count; i++) | ||
882 | { | ||
883 | if (NULL != s->env->info_cb) | ||
884 | s->env->info_cb(s->env->info_cb_cls, GAS_OP_SOLVE_UPDATE_NOTIFICATION_START, | ||
885 | GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL); | ||
886 | propagate_bandwidth(s, &s->network_entries[i], address_except); | ||
887 | if (NULL != s->env->info_cb) | ||
888 | s->env->info_cb(s->env->info_cb_cls, GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP, | ||
889 | GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL); | ||
890 | } | ||
834 | } | 891 | } |
835 | |||
836 | } | 892 | } |
837 | 893 | ||
838 | /** | 894 | /** |
@@ -1053,6 +1109,8 @@ GAS_proportional_get_preferred_address (void *solver, | |||
1053 | struct Network *net_cur; | 1109 | struct Network *net_cur; |
1054 | struct ATS_Address *prev; | 1110 | struct ATS_Address *prev; |
1055 | struct FindBestAddressCtx fba_ctx; | 1111 | struct FindBestAddressCtx fba_ctx; |
1112 | struct AddressSolverInformation *asi; | ||
1113 | struct AddressSolverInformation *asi_prev; | ||
1056 | 1114 | ||
1057 | GNUNET_assert(s != NULL); | 1115 | GNUNET_assert(s != NULL); |
1058 | GNUNET_assert(peer != NULL); | 1116 | GNUNET_assert(peer != NULL); |
@@ -1083,7 +1141,8 @@ GAS_proportional_get_preferred_address (void *solver, | |||
1083 | LOG(GNUNET_ERROR_TYPE_INFO, "Suggesting %s address %p for peer `%s'\n", | 1141 | LOG(GNUNET_ERROR_TYPE_INFO, "Suggesting %s address %p for peer `%s'\n", |
1084 | (GNUNET_NO == fba_ctx.best->active) ? "inactive" : "active", fba_ctx.best, | 1142 | (GNUNET_NO == fba_ctx.best->active) ? "inactive" : "active", fba_ctx.best, |
1085 | GNUNET_i2s (peer)); | 1143 | GNUNET_i2s (peer)); |
1086 | net_cur = (struct Network *) fba_ctx.best->solver_information; | 1144 | asi = fba_ctx.best->solver_information; |
1145 | net_cur = asi->network ; | ||
1087 | if (NULL == fba_ctx.best) | 1146 | if (NULL == fba_ctx.best) |
1088 | { | 1147 | { |
1089 | LOG(GNUNET_ERROR_TYPE_ERROR, | 1148 | LOG(GNUNET_ERROR_TYPE_ERROR, |
@@ -1106,7 +1165,8 @@ GAS_proportional_get_preferred_address (void *solver, | |||
1106 | prev = get_active_address (s, s->addresses, peer); | 1165 | prev = get_active_address (s, s->addresses, peer); |
1107 | if (NULL != prev) | 1166 | if (NULL != prev) |
1108 | { | 1167 | { |
1109 | net_prev = (struct Network *) prev->solver_information; | 1168 | asi_prev = prev->solver_information; |
1169 | net_prev = (struct Network *) asi_prev->network; | ||
1110 | prev->active = GNUNET_NO; /* No active any longer */ | 1170 | prev->active = GNUNET_NO; /* No active any longer */ |
1111 | prev->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */ | 1171 | prev->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */ |
1112 | prev->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */ | 1172 | prev->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */ |
@@ -1115,7 +1175,7 @@ GAS_proportional_get_preferred_address (void *solver, | |||
1115 | distribute_bandwidth_in_network (s, net_prev, NULL); | 1175 | distribute_bandwidth_in_network (s, net_prev, NULL); |
1116 | } | 1176 | } |
1117 | 1177 | ||
1118 | if (GNUNET_NO == (is_bandwidth_available_in_network (fba_ctx.best->solver_information))) | 1178 | if (GNUNET_NO == (is_bandwidth_available_in_network (net_cur))) |
1119 | { | 1179 | { |
1120 | GNUNET_break(0); /* This should never happen*/ | 1180 | GNUNET_break(0); /* This should never happen*/ |
1121 | return NULL ; | 1181 | return NULL ; |
@@ -1139,6 +1199,7 @@ GAS_proportional_stop_get_preferred_address (void *solver, | |||
1139 | { | 1199 | { |
1140 | struct GAS_PROPORTIONAL_Handle *s = solver; | 1200 | struct GAS_PROPORTIONAL_Handle *s = solver; |
1141 | struct ATS_Address *cur; | 1201 | struct ATS_Address *cur; |
1202 | struct AddressSolverInformation *asi; | ||
1142 | struct Network *cur_net; | 1203 | struct Network *cur_net; |
1143 | 1204 | ||
1144 | if (GNUNET_YES | 1205 | if (GNUNET_YES |
@@ -1152,7 +1213,8 @@ GAS_proportional_stop_get_preferred_address (void *solver, | |||
1152 | if (NULL != cur) | 1213 | if (NULL != cur) |
1153 | { | 1214 | { |
1154 | /* Disabling current address */ | 1215 | /* Disabling current address */ |
1155 | cur_net = (struct Network *) cur->solver_information; | 1216 | asi = cur->solver_information; |
1217 | cur_net = asi->network ; | ||
1156 | cur->active = GNUNET_NO; /* No active any longer */ | 1218 | cur->active = GNUNET_NO; /* No active any longer */ |
1157 | cur->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */ | 1219 | cur->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */ |
1158 | cur->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */ | 1220 | cur->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */ |
@@ -1177,6 +1239,7 @@ GAS_proportional_address_delete (void *solver, struct ATS_Address *address, | |||
1177 | struct GAS_PROPORTIONAL_Handle *s = solver; | 1239 | struct GAS_PROPORTIONAL_Handle *s = solver; |
1178 | struct Network *net; | 1240 | struct Network *net; |
1179 | struct AddressWrapper *aw; | 1241 | struct AddressWrapper *aw; |
1242 | struct AddressSolverInformation *asi; | ||
1180 | const struct ATS_Address *new_address; | 1243 | const struct ATS_Address *new_address; |
1181 | 1244 | ||
1182 | 1245 | ||
@@ -1187,8 +1250,8 @@ GAS_proportional_address_delete (void *solver, struct ATS_Address *address, | |||
1187 | * - decrease number of active addreses | 1250 | * - decrease number of active addreses |
1188 | * - update quotas | 1251 | * - update quotas |
1189 | */ | 1252 | */ |
1190 | 1253 | asi = address->solver_information; | |
1191 | net = (struct Network *) address->solver_information; | 1254 | net = asi->network; |
1192 | 1255 | ||
1193 | if (GNUNET_NO == session_only) | 1256 | if (GNUNET_NO == session_only) |
1194 | { | 1257 | { |
@@ -1318,12 +1381,14 @@ GAS_proportional_address_property_changed (void *solver, | |||
1318 | { | 1381 | { |
1319 | struct GAS_PROPORTIONAL_Handle *s; | 1382 | struct GAS_PROPORTIONAL_Handle *s; |
1320 | struct Network *n; | 1383 | struct Network *n; |
1384 | struct AddressSolverInformation *asi; | ||
1321 | 1385 | ||
1322 | GNUNET_assert(NULL != solver); | 1386 | GNUNET_assert(NULL != solver); |
1323 | GNUNET_assert(NULL != address); | 1387 | GNUNET_assert(NULL != address); |
1324 | 1388 | ||
1325 | s = (struct GAS_PROPORTIONAL_Handle *) solver; | 1389 | s = (struct GAS_PROPORTIONAL_Handle *) solver; |
1326 | n = (struct Network *) address->solver_information; | 1390 | asi = address->solver_information; |
1391 | n = asi->network; | ||
1327 | 1392 | ||
1328 | if (NULL == n) | 1393 | if (NULL == n) |
1329 | { | 1394 | { |
@@ -1404,7 +1469,9 @@ GAS_proportional_address_change_network (void *solver, | |||
1404 | struct ATS_Address *address, uint32_t current_network, uint32_t new_network) | 1469 | struct ATS_Address *address, uint32_t current_network, uint32_t new_network) |
1405 | { | 1470 | { |
1406 | struct GAS_PROPORTIONAL_Handle *s = (struct GAS_PROPORTIONAL_Handle *) solver; | 1471 | struct GAS_PROPORTIONAL_Handle *s = (struct GAS_PROPORTIONAL_Handle *) solver; |
1472 | struct AddressSolverInformation *asi; | ||
1407 | int save_active = GNUNET_NO; | 1473 | int save_active = GNUNET_NO; |
1474 | |||
1408 | struct Network *new_net = NULL; | 1475 | struct Network *new_net = NULL; |
1409 | 1476 | ||
1410 | if (current_network == new_network) | 1477 | if (current_network == new_network) |
@@ -1448,7 +1515,8 @@ GAS_proportional_address_change_network (void *solver, | |||
1448 | } | 1515 | } |
1449 | 1516 | ||
1450 | /* Add to new network and update*/ | 1517 | /* Add to new network and update*/ |
1451 | address->solver_information = new_net; | 1518 | asi = address->solver_information; |
1519 | asi->network = new_net; | ||
1452 | GAS_proportional_address_add (solver, address, new_network); | 1520 | GAS_proportional_address_add (solver, address, new_network); |
1453 | if (GNUNET_YES == save_active) | 1521 | if (GNUNET_YES == save_active) |
1454 | { | 1522 | { |
@@ -1488,6 +1556,7 @@ GAS_proportional_address_add (void *solver, struct ATS_Address *address, | |||
1488 | struct GAS_PROPORTIONAL_Handle *s = solver; | 1556 | struct GAS_PROPORTIONAL_Handle *s = solver; |
1489 | struct Network *net = NULL; | 1557 | struct Network *net = NULL; |
1490 | struct AddressWrapper *aw = NULL; | 1558 | struct AddressWrapper *aw = NULL; |
1559 | struct AddressSolverInformation *asi; | ||
1491 | 1560 | ||
1492 | GNUNET_assert(NULL != s); | 1561 | GNUNET_assert(NULL != s); |
1493 | net = get_network (s, network); | 1562 | net = get_network (s, network); |
@@ -1501,7 +1570,12 @@ GAS_proportional_address_add (void *solver, struct ATS_Address *address, | |||
1501 | aw->addr = address; | 1570 | aw->addr = address; |
1502 | GNUNET_CONTAINER_DLL_insert(net->head, net->tail, aw); | 1571 | GNUNET_CONTAINER_DLL_insert(net->head, net->tail, aw); |
1503 | addresse_increment (s, net, GNUNET_YES, GNUNET_NO); | 1572 | addresse_increment (s, net, GNUNET_YES, GNUNET_NO); |
1504 | aw->addr->solver_information = net; | 1573 | |
1574 | asi = GNUNET_malloc (sizeof (struct AddressSolverInformation)); | ||
1575 | asi->network = net; | ||
1576 | asi->calculated_quota_in_NBO = 0; | ||
1577 | asi->calculated_quota_out_NBO = 0; | ||
1578 | aw->addr->solver_information = asi; | ||
1505 | 1579 | ||
1506 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (s->requests, &address->peer)) | 1580 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (s->requests, &address->peer)) |
1507 | { | 1581 | { |