aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats_addresses.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-16 09:34:22 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-16 09:34:22 +0000
commitc1d89ed3cf92fa2492a5639e725aadd74742f135 (patch)
tree2c3b364f98947d36151e148eba8978f98b960da4 /src/ats/gnunet-service-ats_addresses.c
parentc345e101fd271feb03c311d0ec1837fc6cf179f3 (diff)
downloadgnunet-c1d89ed3cf92fa2492a5639e725aadd74742f135.tar.gz
gnunet-c1d89ed3cf92fa2492a5639e725aadd74742f135.zip
do not use session_id in GAS_performance_notify_all_clients, needs to be 'active'; also indentation/doxygen
Diffstat (limited to 'src/ats/gnunet-service-ats_addresses.c')
-rw-r--r--src/ats/gnunet-service-ats_addresses.c317
1 files changed, 192 insertions, 125 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index 98340e86a..ca8afecd9 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -465,6 +465,7 @@ free_address (struct ATS_Address *addr)
465 GNUNET_free(addr); 465 GNUNET_free(addr);
466} 466}
467 467
468
468/** 469/**
469 * Create a ATS_address with the given information 470 * Create a ATS_address with the given information
470 * 471 *
@@ -473,16 +474,16 @@ free_address (struct ATS_Address *addr)
473 * @param plugin_addr address 474 * @param plugin_addr address
474 * @param plugin_addr_len address length 475 * @param plugin_addr_len address length
475 * @param local_address_info additional local info for the address 476 * @param local_address_info additional local info for the address
476 * @param session_id session 477 * @param session_id session identifier, can be 0
477 * @return the ATS_Address 478 * @return the ATS_Address
478 */ 479 */
479static struct ATS_Address * 480static struct ATS_Address *
480create_address (const struct GNUNET_PeerIdentity *peer, 481create_address (const struct GNUNET_PeerIdentity *peer,
481 const char *plugin_name, 482 const char *plugin_name,
482 const void *plugin_addr, 483 const void *plugin_addr,
483 size_t plugin_addr_len, 484 size_t plugin_addr_len,
484 uint32_t local_address_info, 485 uint32_t local_address_info,
485 uint32_t session_id) 486 uint32_t session_id)
486{ 487{
487 struct ATS_Address *aa = NULL; 488 struct ATS_Address *aa = NULL;
488 int c1; 489 int c1;
@@ -496,13 +497,6 @@ create_address (const struct GNUNET_PeerIdentity *peer,
496 aa->plugin = GNUNET_strdup (plugin_name); 497 aa->plugin = GNUNET_strdup (plugin_name);
497 aa->session_id = session_id; 498 aa->session_id = session_id;
498 aa->local_address_info = local_address_info; 499 aa->local_address_info = local_address_info;
499 aa->active = GNUNET_NO;
500 aa->used = GNUNET_NO;
501 aa->solver_information = NULL;
502 aa->atsi = NULL;
503 aa->atsi_count = 0;
504 aa->assigned_bw_in = GNUNET_BANDWIDTH_value_init (0);
505 aa->assigned_bw_out = GNUNET_BANDWIDTH_value_init (0);
506 500
507 for (c1 = 0; c1 < GNUNET_ATS_QualityPropertiesCount; c1++) 501 for (c1 = 0; c1 < GNUNET_ATS_QualityPropertiesCount; c1++)
508 { 502 {
@@ -787,29 +781,39 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle,
787 new_address, 781 new_address,
788 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); 782 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
789 783
790 GNUNET_STATISTICS_set (handle->stat, "# addresses", 784 GNUNET_STATISTICS_set (handle->stat,
791 GNUNET_CONTAINER_multipeermap_size (handle->addresses), GNUNET_NO); 785 "# addresses",
786 GNUNET_CONTAINER_multipeermap_size (handle->addresses),
787 GNUNET_NO);
792 788
793 GNUNET_log(GNUNET_ERROR_TYPE_INFO, 789 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
794 "Adding new address %p for peer `%s', length %u, session id %u, %s\n", 790 "Adding new address %p for peer `%s', length %u, session id %u, %s\n",
795 new_address, 791 new_address,
796 GNUNET_i2s (peer), 792 GNUNET_i2s (peer),
797 plugin_addr_len, session_id, 793 plugin_addr_len,
798 GNUNET_ATS_print_network_type (addr_net)); 794 session_id,
795 GNUNET_ATS_print_network_type (addr_net));
799 796
800 /* Tell solver about new address */ 797 /* Tell solver about new address */
801 handle->env.sf.s_add (handle->solver, new_address, addr_net); 798 handle->env.sf.s_add (handle->solver, new_address, addr_net);
802 799
803 handle->env.sf.s_bulk_start (handle->solver); 800 handle->env.sf.s_bulk_start (handle->solver);
804 GAS_normalization_normalize_property (handle->addresses, new_address, atsi, 801 GAS_normalization_normalize_property (handle->addresses,
805 atsi_count); 802 new_address,
803 atsi,
804 atsi_count);
806 handle->env.sf.s_bulk_stop (handle->solver); 805 handle->env.sf.s_bulk_stop (handle->solver);
807 806
808 /* Notify performance clients about new address */ 807 /* Notify performance clients about new address */
809 GAS_performance_notify_all_clients (&new_address->peer, new_address->plugin, 808 GAS_performance_notify_all_clients (&new_address->peer,
810 new_address->addr, new_address->addr_len, new_address->session_id, 809 new_address->plugin,
811 new_address->atsi, new_address->atsi_count, 810 new_address->addr,
812 new_address->assigned_bw_out, new_address->assigned_bw_in); 811 new_address->addr_len,
812 new_address->active,
813 new_address->atsi,
814 new_address->atsi_count,
815 new_address->assigned_bw_out,
816 new_address->assigned_bw_in);
813 return; 817 return;
814 } 818 }
815 819
@@ -845,10 +849,14 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle,
845 { 849 {
846 /* Notify performance clients about properties */ 850 /* Notify performance clients about properties */
847 GAS_performance_notify_all_clients (&existing_address->peer, 851 GAS_performance_notify_all_clients (&existing_address->peer,
848 existing_address->plugin, existing_address->addr, 852 existing_address->plugin,
849 existing_address->addr_len, existing_address->session_id, 853 existing_address->addr,
850 existing_address->atsi, existing_address->atsi_count, 854 existing_address->addr_len,
851 existing_address->assigned_bw_out, existing_address->assigned_bw_in); 855 existing_address->active,
856 existing_address->atsi,
857 existing_address->atsi_count,
858 existing_address->assigned_bw_out,
859 existing_address->assigned_bw_in);
852 860
853 for (c1 = 0; c1 < atsi_delta_count; c1++) 861 for (c1 = 0; c1 < atsi_delta_count; c1++)
854 { 862 {
@@ -909,14 +917,14 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle,
909 */ 917 */
910void 918void
911GAS_addresses_update (struct GAS_Addresses_Handle *handle, 919GAS_addresses_update (struct GAS_Addresses_Handle *handle,
912 const struct GNUNET_PeerIdentity *peer, 920 const struct GNUNET_PeerIdentity *peer,
913 const char *plugin_name, 921 const char *plugin_name,
914 const void *plugin_addr, 922 const void *plugin_addr,
915 size_t plugin_addr_len, 923 size_t plugin_addr_len,
916 uint32_t local_address_info, 924 uint32_t local_address_info,
917 uint32_t session_id, 925 uint32_t session_id,
918 const struct GNUNET_ATS_Information *atsi, 926 const struct GNUNET_ATS_Information *atsi,
919 uint32_t atsi_count) 927 uint32_t atsi_count)
920{ 928{
921 struct ATS_Address *aa; 929 struct ATS_Address *aa;
922 struct GNUNET_ATS_Information *atsi_delta; 930 struct GNUNET_ATS_Information *atsi_delta;
@@ -937,8 +945,10 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle,
937 if (NULL == aa->solver_information) 945 if (NULL == aa->solver_information)
938 return; 946 return;
939 947
940 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received `%s' for peer `%s' address \n", 948 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
941 "ADDRESS UPDATE", GNUNET_i2s (peer), aa); 949 "Received `%s' for peer `%s' address \n",
950 "ADDRESS UPDATE",
951 GNUNET_i2s (peer), aa);
942 952
943 /* Update address */ 953 /* Update address */
944 aa->t_last_activity = GNUNET_TIME_absolute_get(); 954 aa->t_last_activity = GNUNET_TIME_absolute_get();
@@ -947,15 +957,19 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle,
947 /* Session changed */ 957 /* Session changed */
948 prev_session = aa->session_id; 958 prev_session = aa->session_id;
949 aa->session_id = session_id; 959 aa->session_id = session_id;
950 handle->env.sf.s_address_update_session (handle->solver, aa, prev_session, 960 handle->env.sf.s_address_update_session (handle->solver,
951 aa->session_id); 961 aa,
962 prev_session,
963 aa->session_id);
952 } 964 }
953 965
954 atsi_delta = NULL; 966 atsi_delta = NULL;
955 atsi_delta_count = 0; 967 atsi_delta_count = 0;
956 if (GNUNET_YES 968 if (GNUNET_YES ==
957 == disassemble_ats_information (aa, atsi, atsi_count, &atsi_delta, 969 disassemble_ats_information (aa, atsi,
958 &atsi_delta_count)) 970 atsi_count,
971 &atsi_delta,
972 &atsi_delta_count))
959 { 973 {
960 /* ATS properties changed */ 974 /* ATS properties changed */
961 for (c1 = 0; c1 < atsi_delta_count; c1++) 975 for (c1 = 0; c1 < atsi_delta_count; c1++)
@@ -970,31 +984,49 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle,
970 } 984 }
971 985
972 /* Notify performance clients about updated address */ 986 /* Notify performance clients about updated address */
973 GAS_performance_notify_all_clients (&aa->peer, aa->plugin, aa->addr, 987 GAS_performance_notify_all_clients (&aa->peer,
974 aa->addr_len, aa->session_id, aa->atsi, aa->atsi_count, 988 aa->plugin,
975 aa->assigned_bw_out, aa->assigned_bw_in); 989 aa->addr,
976 990 aa->addr_len,
991 aa->active,
992 aa->atsi,
993 aa->atsi_count,
994 aa->assigned_bw_out,
995 aa->assigned_bw_in);
977 handle->env.sf.s_bulk_start (handle->solver); 996 handle->env.sf.s_bulk_start (handle->solver);
978 GAS_normalization_normalize_property (handle->addresses, aa, atsi, 997 GAS_normalization_normalize_property (handle->addresses,
979 atsi_count); 998 aa,
999 atsi,
1000 atsi_count);
980 handle->env.sf.s_bulk_stop (handle->solver); 1001 handle->env.sf.s_bulk_stop (handle->solver);
981 } 1002 }
982 GNUNET_free_non_null(atsi_delta); 1003 GNUNET_free_non_null (atsi_delta);
983} 1004}
984 1005
1006
1007/**
1008 * Closure for #destroy_by_session_id().
1009 */
985struct DestroyContext 1010struct DestroyContext
986{ 1011{
1012 /**
1013 * FIXME.
1014 */
987 struct ATS_Address *aa; 1015 struct ATS_Address *aa;
988 1016
1017 /**
1018 * FIXME.
1019 */
989 struct GAS_Addresses_Handle *handle; 1020 struct GAS_Addresses_Handle *handle;
990 1021
991 /** 1022 /**
992 * GNUNET_NO : full address 1023 * #GNUNET_NO : full address
993 * GNUNET_YES : just session 1024 * #GNUNET_YES : just session
994 */ 1025 */
995 int result; 1026 int result;
996}; 1027};
997 1028
1029
998/** 1030/**
999 * Delete an address 1031 * Delete an address
1000 * 1032 *
@@ -1004,8 +1036,8 @@ struct DestroyContext
1004 * 1036 *
1005 * @param cls unused 1037 * @param cls unused
1006 * @param key unused 1038 * @param key unused
1007 * @param value the 'struct ATS_Address' 1039 * @param value the `struct ATS_Address *`
1008 * @return GNUNET_OK (continue to iterate) 1040 * @return #GNUNET_OK (continue to iterate)
1009 */ 1041 */
1010static int 1042static int
1011destroy_by_session_id (void *cls, 1043destroy_by_session_id (void *cls,
@@ -1028,15 +1060,17 @@ destroy_by_session_id (void *cls,
1028 && (0 == memcmp (des->addr, aa->addr, aa->addr_len))) 1060 && (0 == memcmp (des->addr, aa->addr, aa->addr_len)))
1029 { 1061 {
1030 1062
1031 GNUNET_log(GNUNET_ERROR_TYPE_INFO, 1063 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1032 "Deleting full address for peer `%s' session %u %p\n", 1064 "Deleting full address for peer `%s' session %u %p\n",
1033 GNUNET_i2s (&aa->peer), aa->session_id, aa); 1065 GNUNET_i2s (&aa->peer),
1066 aa->session_id,
1067 aa);
1034 1068
1035 /* Notify solver about deletion */ 1069 /* Notify solver about deletion */
1036 GNUNET_assert( 1070 GNUNET_assert (GNUNET_YES ==
1037 GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (handle->addresses, 1071 GNUNET_CONTAINER_multipeermap_remove (handle->addresses,
1038 &aa->peer, 1072 &aa->peer,
1039 aa)); 1073 aa));
1040 handle->env.sf.s_del (handle->solver, aa, GNUNET_NO); 1074 handle->env.sf.s_del (handle->solver, aa, GNUNET_NO);
1041 free_address (aa); 1075 free_address (aa);
1042 dc->result = GNUNET_NO; 1076 dc->result = GNUNET_NO;
@@ -1051,24 +1085,27 @@ destroy_by_session_id (void *cls,
1051 1085
1052 if ((aa->session_id != 0) && (0 != strcmp (des->plugin, aa->plugin))) 1086 if ((aa->session_id != 0) && (0 != strcmp (des->plugin, aa->plugin)))
1053 { 1087 {
1054 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 1088 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1055 "Different plugins during removal: `%s' vs `%s' \n", des->plugin, 1089 "Different plugins during removal: `%s' vs `%s' \n",
1056 aa->plugin); 1090 des->plugin,
1057 GNUNET_break(0); 1091 aa->plugin);
1092 GNUNET_break (0);
1058 return GNUNET_OK; 1093 return GNUNET_OK;
1059 } 1094 }
1060 if (GNUNET_HELLO_ADDRESS_INFO_INBOUND == 1095 if (GNUNET_HELLO_ADDRESS_INFO_INBOUND ==
1061 (aa->local_address_info && GNUNET_HELLO_ADDRESS_INFO_INBOUND)) 1096 (aa->local_address_info && GNUNET_HELLO_ADDRESS_INFO_INBOUND))
1062 { 1097 {
1063 /* Inbound connection died, delete full address */ 1098 /* Inbound connection died, delete full address */
1064 GNUNET_log(GNUNET_ERROR_TYPE_INFO, 1099 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1065 "Deleting inbound address for peer `%s': `%s' session %u\n", 1100 "Deleting inbound address for peer `%s': `%s' session %u\n",
1066 GNUNET_i2s (&aa->peer), aa->plugin, aa->session_id); 1101 GNUNET_i2s (&aa->peer),
1102 aa->plugin,
1103 aa->session_id);
1067 1104
1068 /* Notify solver about deletion */ 1105 /* Notify solver about deletion */
1069 GNUNET_assert( 1106 GNUNET_assert(GNUNET_YES ==
1070 GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (handle->addresses, 1107 GNUNET_CONTAINER_multipeermap_remove (handle->addresses,
1071 &aa->peer, aa)); 1108 &aa->peer, aa));
1072 handle->env.sf.s_del (handle->solver, aa, GNUNET_NO); 1109 handle->env.sf.s_del (handle->solver, aa, GNUNET_NO);
1073 free_address (aa); 1110 free_address (aa);
1074 dc->result = GNUNET_NO; 1111 dc->result = GNUNET_NO;
@@ -1078,8 +1115,9 @@ destroy_by_session_id (void *cls,
1078 { 1115 {
1079 /* Session died */ 1116 /* Session died */
1080 GNUNET_log(GNUNET_ERROR_TYPE_INFO, 1117 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
1081 "Deleting session for peer `%s': `%s' %u\n", GNUNET_i2s (&aa->peer), 1118 "Deleting session for peer `%s': `%s' %u\n",
1082 aa->plugin, aa->session_id); 1119 GNUNET_i2s (&aa->peer),
1120 aa->plugin, aa->session_id);
1083 /* Notify solver to delete session */ 1121 /* Notify solver to delete session */
1084 handle->env.sf.s_del (handle->solver, aa, GNUNET_YES); 1122 handle->env.sf.s_del (handle->solver, aa, GNUNET_YES);
1085 aa->session_id = 0; 1123 aa->session_id = 0;
@@ -1104,15 +1142,16 @@ destroy_by_session_id (void *cls,
1104 */ 1142 */
1105void 1143void
1106GAS_addresses_destroy (struct GAS_Addresses_Handle *handle, 1144GAS_addresses_destroy (struct GAS_Addresses_Handle *handle,
1107 const struct GNUNET_PeerIdentity *peer, 1145 const struct GNUNET_PeerIdentity *peer,
1108 const char *plugin_name, 1146 const char *plugin_name,
1109 const void *plugin_addr, 1147 const void *plugin_addr,
1110 size_t plugin_addr_len, 1148 size_t plugin_addr_len,
1111 uint32_t local_address_info, 1149 uint32_t local_address_info,
1112 uint32_t session_id) 1150 uint32_t session_id)
1113{ 1151{
1114 struct ATS_Address *ea; 1152 struct ATS_Address *ea;
1115 struct DestroyContext dc; 1153 struct DestroyContext dc;
1154
1116 if (GNUNET_NO == handle->running) 1155 if (GNUNET_NO == handle->running)
1117 return; 1156 return;
1118 1157
@@ -1122,36 +1161,45 @@ GAS_addresses_destroy (struct GAS_Addresses_Handle *handle,
1122 if (ea == NULL ) 1161 if (ea == NULL )
1123 { 1162 {
1124 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1163 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1125 "Tried to destroy unknown address for peer `%s' `%s' session id %u\n", 1164 "Tried to destroy unknown address for peer `%s' `%s' session id %u\n",
1126 GNUNET_i2s (peer), plugin_name, session_id); 1165 GNUNET_i2s (peer),
1166 plugin_name,
1167 session_id);
1127 return; 1168 return;
1128 } 1169 }
1129 1170
1130 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1171 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1131 "Received `%s' for peer `%s' address %p session %u\n", "ADDRESS DESTROY", 1172 "Received `%s' for peer `%s' address %p session %u\n", "ADDRESS DESTROY",
1132 GNUNET_i2s (peer), ea, session_id); 1173 GNUNET_i2s (peer),
1174 ea,
1175 session_id);
1133 1176
1134 GNUNET_break(0 < strlen (plugin_name)); 1177 GNUNET_break(0 < strlen (plugin_name));
1135 dc.handle = handle; 1178 dc.handle = handle;
1136 dc.aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len, 1179 dc.aa = create_address (peer,
1137 local_address_info, session_id); 1180 plugin_name,
1138 1181 plugin_addr,
1182 plugin_addr_len,
1183 local_address_info, session_id);
1139 GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses, 1184 GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses,
1140 peer, 1185 peer,
1141 &destroy_by_session_id, &dc); 1186 &destroy_by_session_id, &dc);
1142 GNUNET_STATISTICS_set (handle->stat, "# addresses", 1187 GNUNET_STATISTICS_set (handle->stat,
1143 GNUNET_CONTAINER_multipeermap_size (handle->addresses), GNUNET_NO); 1188 "# addresses",
1189 GNUNET_CONTAINER_multipeermap_size (handle->addresses),
1190 GNUNET_NO);
1144 free_address (dc.aa); 1191 free_address (dc.aa);
1145} 1192}
1146 1193
1194
1147/** 1195/**
1148 * Notification about active use of an address. 1196 * Notification about active use of an address.
1149 * in_use == GNUNET_YES: 1197 * in_use == #GNUNET_YES:
1150 * This address is used to maintain an active connection with a peer. 1198 * This address is used to maintain an active connection with a peer.
1151 * in_use == GNUNET_NO: 1199 * in_use == #GNUNET_NO:
1152 * This address is no longer used to maintain an active connection with a peer. 1200 * This address is no longer used to maintain an active connection with a peer.
1153 * 1201 *
1154 * Note: can only be called with in_use == GNUNET_NO if called with GNUNET_YES 1202 * Note: can only be called with in_use == #GNUNET_NO if called with #GNUNET_YES
1155 * before 1203 * before
1156 * 1204 *
1157 * @param handle the address handle to use 1205 * @param handle the address handle to use
@@ -1161,52 +1209,64 @@ GAS_addresses_destroy (struct GAS_Addresses_Handle *handle,
1161 * @param plugin_addr_len length of the plugin address 1209 * @param plugin_addr_len length of the plugin address
1162 * @param local_address_info the local address for the address 1210 * @param local_address_info the local address for the address
1163 * @param session_id session id, can be 0 1211 * @param session_id session id, can be 0
1164 * @param in_use GNUNET_YES if GNUNET_NO 1212 * @param in_use #GNUNET_YES if #GNUNET_NO FIXME
1165 * @return GNUNET_SYSERR on failure (address unknown ...) 1213 * @return #GNUNET_SYSERR on failure (address unknown ...)
1166 */ 1214 */
1167int 1215int
1168GAS_addresses_in_use (struct GAS_Addresses_Handle *handle, 1216GAS_addresses_in_use (struct GAS_Addresses_Handle *handle,
1169 const struct GNUNET_PeerIdentity *peer, const char *plugin_name, 1217 const struct GNUNET_PeerIdentity *peer,
1170 const void *plugin_addr, size_t plugin_addr_len, 1218 const char *plugin_name,
1171 uint32_t local_address_info, 1219 const void *plugin_addr,
1172 uint32_t session_id, 1220 size_t plugin_addr_len,
1173 int in_use) 1221 uint32_t local_address_info,
1222 uint32_t session_id,
1223 int in_use)
1174{ 1224{
1175 struct ATS_Address *ea; 1225 struct ATS_Address *ea;
1176 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received `%s' for peer `%s'\n",
1177 "ADDRESS IN USE", GNUNET_i2s (peer));
1178 1226
1227 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1228 "Received `%s' for peer `%s'\n",
1229 "ADDRESS IN USE",
1230 GNUNET_i2s (peer));
1179 if (GNUNET_NO == handle->running) 1231 if (GNUNET_NO == handle->running)
1180 return GNUNET_SYSERR; 1232 return GNUNET_SYSERR;
1181 1233 ea = find_exact_address (handle,
1182 ea = find_exact_address (handle, peer, plugin_name, plugin_addr, 1234 peer, plugin_name,
1183 plugin_addr_len, local_address_info, session_id); 1235 plugin_addr,
1236 plugin_addr_len,
1237 local_address_info,
1238 session_id);
1184 if (NULL == ea) 1239 if (NULL == ea)
1185 { 1240 {
1186 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 1241 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1187 "Trying to set unknown address `%s' `%s' `%u' to %s \n", 1242 "Trying to set unknown address `%s' `%s' `%u' to %s \n",
1188 GNUNET_i2s (peer), plugin_name, session_id, 1243 GNUNET_i2s (peer),
1189 (GNUNET_NO == in_use) ? "NO" : "YES"); 1244 plugin_name,
1190 GNUNET_break(0); 1245 session_id,
1246 (GNUNET_NO == in_use) ? "NO" : "YES");
1247 GNUNET_break (0);
1191 return GNUNET_SYSERR; 1248 return GNUNET_SYSERR;
1192 } 1249 }
1193 if (ea->used == in_use) 1250 if (ea->used == in_use)
1194 { 1251 {
1195 GNUNET_break(0); 1252 GNUNET_break (0);
1196 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 1253 GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
1197 "Address in use called multiple times for peer `%s': %s -> %s \n", 1254 "Address in use called multiple times for peer `%s': %s -> %s \n",
1198 GNUNET_i2s (peer), (GNUNET_NO == ea->used) ? "NO" : "YES", 1255 GNUNET_i2s (peer),
1199 (GNUNET_NO == in_use) ? "NO" : "YES"); 1256 (GNUNET_NO == ea->used) ? "NO" : "YES",
1257 (GNUNET_NO == in_use) ? "NO" : "YES");
1200 return GNUNET_SYSERR; 1258 return GNUNET_SYSERR;
1201 } 1259 }
1202
1203 /* Tell solver about update */ 1260 /* Tell solver about update */
1204 ea->used = in_use; 1261 ea->used = in_use;
1205 ea->t_last_activity = GNUNET_TIME_absolute_get(); 1262 ea->t_last_activity = GNUNET_TIME_absolute_get();
1206 handle->env.sf.s_address_update_inuse (handle->solver, ea, ea->used); 1263 handle->env.sf.s_address_update_inuse (handle->solver,
1264 ea,
1265 ea->used);
1207 return GNUNET_OK; 1266 return GNUNET_OK;
1208} 1267}
1209 1268
1269
1210/** 1270/**
1211 * Cancel address suggestions for a peer 1271 * Cancel address suggestions for a peer
1212 * 1272 *
@@ -1744,6 +1804,7 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
1744 return GNUNET_ATS_NetworkTypeCount; 1804 return GNUNET_ATS_NetworkTypeCount;
1745} 1805}
1746 1806
1807
1747/** 1808/**
1748 * Callback for solver to notify about assignment changes 1809 * Callback for solver to notify about assignment changes
1749 * 1810 *
@@ -1751,22 +1812,28 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
1751 * @param address the address with changes 1812 * @param address the address with changes
1752 */ 1813 */
1753static void 1814static void
1754bandwidth_changed_cb (void *cls, struct ATS_Address *address) 1815bandwidth_changed_cb (void *cls,
1816 struct ATS_Address *address)
1755{ 1817{
1756 struct GAS_Addresses_Handle *handle = cls; 1818 struct GAS_Addresses_Handle *handle = cls;
1757 struct GAS_Addresses_Suggestion_Requests *cur; 1819 struct GAS_Addresses_Suggestion_Requests *cur;
1758 1820
1759 GNUNET_assert(handle != NULL); 1821 GNUNET_assert(handle != NULL);
1760 GNUNET_assert(address != NULL); 1822 GNUNET_assert(address != NULL);
1761 1823 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1762 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1824 "Bandwidth assignment changed for peer %s \n",
1763 "Bandwidth assignment changed for peer %s \n", 1825 GNUNET_i2s (&address->peer));
1764 GNUNET_i2s (&address->peer));
1765 1826
1766 /* Notify performance clients about changes to address */ 1827 /* Notify performance clients about changes to address */
1767 GAS_performance_notify_all_clients (&address->peer, address->plugin, 1828 GAS_performance_notify_all_clients (&address->peer,
1768 address->addr, address->addr_len, address->session_id, address->atsi, 1829 address->plugin,
1769 address->atsi_count, address->assigned_bw_out, address->assigned_bw_in); 1830 address->addr,
1831 address->addr_len,
1832 address->active,
1833 address->atsi,
1834 address->atsi_count,
1835 address->assigned_bw_out,
1836 address->assigned_bw_in);
1770 cur = handle->pending_requests_head; 1837 cur = handle->pending_requests_head;
1771 while (NULL != cur) 1838 while (NULL != cur)
1772 { 1839 {