diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-04-03 11:12:10 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-04-03 11:12:10 +0000 |
commit | 4e6ef3777767569c4b92ca630837d1a1b1248e4f (patch) | |
tree | 055d1d7362f1994318c3497fdb548a4442395c5c /src | |
parent | 533dfb8408d57317bad310fa24853bcb2d6fb3b6 (diff) | |
download | gnunet-4e6ef3777767569c4b92ca630837d1a1b1248e4f.tar.gz gnunet-4e6ef3777767569c4b92ca630837d1a1b1248e4f.zip |
fixed network switching
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 5 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses_simplistic.c | 28 |
2 files changed, 16 insertions, 17 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index ce4346e55..52b60cba1 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -895,9 +895,6 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle, | |||
895 | "ADDRESS UPDATE", | 895 | "ADDRESS UPDATE", |
896 | GNUNET_i2s (peer), aa); | 896 | GNUNET_i2s (peer), aa); |
897 | 897 | ||
898 | /* Tell solver about update */ | ||
899 | handle->s_update (handle->solver, handle->addresses, aa, session_id, aa->used, atsi, atsi_count); | ||
900 | |||
901 | /* Update address */ | 898 | /* Update address */ |
902 | atsi_delta = NULL; | 899 | atsi_delta = NULL; |
903 | if (GNUNET_YES == disassemble_ats_information (aa, atsi, atsi_count, &atsi_delta, &atsi_delta_count)) | 900 | if (GNUNET_YES == disassemble_ats_information (aa, atsi, atsi_count, &atsi_delta, &atsi_delta_count)) |
@@ -911,6 +908,8 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle, | |||
911 | aa->assigned_bw_out, | 908 | aa->assigned_bw_out, |
912 | aa->assigned_bw_in); | 909 | aa->assigned_bw_in); |
913 | } | 910 | } |
911 | /* Tell solver about update */ | ||
912 | handle->s_update (handle->solver, handle->addresses, aa, session_id, aa->used, atsi_delta, atsi_delta_count); | ||
914 | GNUNET_free_non_null (atsi_delta); | 913 | GNUNET_free_non_null (atsi_delta); |
915 | } | 914 | } |
916 | 915 | ||
diff --git a/src/ats/gnunet-service-ats_addresses_simplistic.c b/src/ats/gnunet-service-ats_addresses_simplistic.c index c773eaa0c..1e847cb31 100644 --- a/src/ats/gnunet-service-ats_addresses_simplistic.c +++ b/src/ats/gnunet-service-ats_addresses_simplistic.c | |||
@@ -937,22 +937,22 @@ GAS_simplistic_address_update (void *solver, | |||
937 | struct ATS_Address *address, | 937 | struct ATS_Address *address, |
938 | uint32_t session, | 938 | uint32_t session, |
939 | int in_use, | 939 | int in_use, |
940 | const struct GNUNET_ATS_Information *atsi, | 940 | const struct GNUNET_ATS_Information *prev_ats, |
941 | uint32_t atsi_count) | 941 | uint32_t prev_atsi_count) |
942 | { | 942 | { |
943 | struct ATS_Address *new; | 943 | struct ATS_Address *new; |
944 | struct GAS_SIMPLISTIC_Handle *s = (struct GAS_SIMPLISTIC_Handle *) solver; | 944 | struct GAS_SIMPLISTIC_Handle *s = (struct GAS_SIMPLISTIC_Handle *) solver; |
945 | int i; | 945 | int i; |
946 | uint32_t value; | 946 | uint32_t prev_value; |
947 | uint32_t type; | 947 | uint32_t prev_type; |
948 | uint32_t addr_net; | 948 | uint32_t addr_net; |
949 | int save_active = GNUNET_NO; | 949 | int save_active = GNUNET_NO; |
950 | struct Network *new_net = NULL; | 950 | struct Network *new_net = NULL; |
951 | for (i = 0; i < atsi_count; i++) | 951 | for (i = 0; i < prev_atsi_count; i++) |
952 | { | 952 | { |
953 | type = ntohl (atsi[i].type); | 953 | prev_type = ntohl (prev_ats[i].type); |
954 | value = ntohl (atsi[i].value); | 954 | prev_value = ntohl (prev_ats[i].value); |
955 | switch (type) | 955 | switch (prev_type) |
956 | { | 956 | { |
957 | case GNUNET_ATS_UTILIZATION_UP: | 957 | case GNUNET_ATS_UTILIZATION_UP: |
958 | //if (address->atsp_utilization_out.value__ != atsi[i].value) | 958 | //if (address->atsp_utilization_out.value__ != atsi[i].value) |
@@ -989,24 +989,24 @@ GAS_simplistic_address_update (void *solver, | |||
989 | GNUNET_break (0); | 989 | GNUNET_break (0); |
990 | addr_net = GNUNET_ATS_NET_UNSPECIFIED; | 990 | addr_net = GNUNET_ATS_NET_UNSPECIFIED; |
991 | } | 991 | } |
992 | if (addr_net != value) | 992 | if (addr_net != prev_value) |
993 | { | 993 | { |
994 | 994 | ||
995 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Network type changed, moving %s address from `%s' to `%s'\n", | 995 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Network type changed, moving %s address from `%s' to `%s'\n", |
996 | (GNUNET_YES == address->active) ? "active" : "inactive", | 996 | (GNUNET_YES == address->active) ? "active" : "inactive", |
997 | GNUNET_ATS_print_network_type(addr_net), | 997 | GNUNET_ATS_print_network_type(prev_value), |
998 | GNUNET_ATS_print_network_type(value)); | 998 | GNUNET_ATS_print_network_type(addr_net)); |
999 | 999 | ||
1000 | save_active = address->active; | 1000 | save_active = address->active; |
1001 | /* remove from old network */ | 1001 | /* remove from old network */ |
1002 | GAS_simplistic_address_delete (solver, addresses, address, GNUNET_NO); | 1002 | GAS_simplistic_address_delete (solver, addresses, address, GNUNET_NO); |
1003 | 1003 | ||
1004 | /* set new network type */ | 1004 | /* set new network type */ |
1005 | new_net = find_network (solver, value); | 1005 | new_net = find_network (solver, addr_net); |
1006 | address->solver_information = new_net; | 1006 | address->solver_information = new_net; |
1007 | 1007 | ||
1008 | /* Add to new network and update*/ | 1008 | /* Add to new network and update*/ |
1009 | GAS_simplistic_address_add (solver, addresses, address, value); | 1009 | GAS_simplistic_address_add (solver, addresses, address, addr_net); |
1010 | if (GNUNET_YES == save_active) | 1010 | if (GNUNET_YES == save_active) |
1011 | { | 1011 | { |
1012 | /* check if bandwidth available in new network */ | 1012 | /* check if bandwidth available in new network */ |
@@ -1043,7 +1043,7 @@ GAS_simplistic_address_update (void *solver, | |||
1043 | break; | 1043 | break; |
1044 | default: | 1044 | default: |
1045 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1045 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1046 | "Received unsupported ATS type %u\n", type); | 1046 | "Received unsupported ATS type %u\n", prev_type); |
1047 | GNUNET_break (0); | 1047 | GNUNET_break (0); |
1048 | break; | 1048 | break; |
1049 | 1049 | ||