aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats_addresses_simplistic.c
diff options
context:
space:
mode:
authorwachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96>2012-12-12 15:32:42 +0000
committerwachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96>2012-12-12 15:32:42 +0000
commitae1dd5a3a68917accf34872829190a1c75ebc4b9 (patch)
tree58ecbf493bdd0b10f1c48ffe726fbd42438630e7 /src/ats/gnunet-service-ats_addresses_simplistic.c
parent808f9ff9a268ef80bae6e36fb0ef6e666986c9b5 (diff)
updating addresses support changing networks
git-svn-id: https://gnunet.org/svn/gnunet@25424 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/ats/gnunet-service-ats_addresses_simplistic.c')
-rw-r--r--src/ats/gnunet-service-ats_addresses_simplistic.c90
1 files changed, 73 insertions, 17 deletions
diff --git a/src/ats/gnunet-service-ats_addresses_simplistic.c b/src/ats/gnunet-service-ats_addresses_simplistic.c
index 37491dd7f2..95f9294f4f 100644
--- a/src/ats/gnunet-service-ats_addresses_simplistic.c
+++ b/src/ats/gnunet-service-ats_addresses_simplistic.c
@@ -337,27 +337,83 @@ GAS_simplistic_address_add (void *solver, struct GNUNET_CONTAINER_MultiHashMap *
* @param address the update address
*/
void
-GAS_simplistic_address_update (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address)
+GAS_simplistic_address_update (void *solver,
+ struct GNUNET_CONTAINER_MultiHashMap *addresses,
+ struct ATS_Address *address,
+ uint32_t session,
+ int in_use,
+ const struct GNUNET_ATS_Information *atsi,
+ uint32_t atsi_count)
{
-#if 0
- struct GAS_SIMPLISTIC_Handle *s = solver;
- GNUNET_assert (NULL != s);
- int c;
- for (c = 0; c < s->networks; c++)
+ int i;
+ uint32_t value;
+ uint32_t type;
+ for (i = 0; i < atsi_count; i++)
{
- if (address->atsp_network_type == s->quota_net[c])
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Updating address for network type %u (%u total)\n",
- address->atsp_network_type,
- s->active_addresses_per_net[c]);
- break;
- }
+ type = ntohl (atsi[i].type);
+ value = ntohl (atsi[i].value);
+ switch (type)
+ {
+ case GNUNET_ATS_UTILIZATION_UP:
+ //if (address->atsp_utilization_out.value__ != atsi[i].value)
+
+ break;
+ case GNUNET_ATS_UTILIZATION_DOWN:
+ //if (address->atsp_utilization_in.value__ != atsi[i].value)
+
+ break;
+ case GNUNET_ATS_QUALITY_NET_DELAY:
+ //if (address->atsp_latency.rel_value != value)
+
+ break;
+ case GNUNET_ATS_QUALITY_NET_DISTANCE:
+ //if (address->atsp_distance != value)
+
+ break;
+ case GNUNET_ATS_COST_WAN:
+ //if (address->atsp_cost_wan != value)
+
+ break;
+ case GNUNET_ATS_COST_LAN:
+ //if (address->atsp_cost_lan != value)
+
+ break;
+ case GNUNET_ATS_COST_WLAN:
+ //if (address->atsp_cost_wlan != value)
+
+ break;
+ case GNUNET_ATS_NETWORK_TYPE:
+ if (address->atsp_network_type != value)
+ LOG (GNUNET_ERROR_TYPE_ERROR, "Network changed from `%s' to `%s'\n",
+ GNUNET_ATS_print_network_type(address->atsp_network_type),
+ GNUNET_ATS_print_network_type(value));
+ break;
+ case GNUNET_ATS_ARRAY_TERMINATOR:
+ break;
+ default:
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Received unsupported ATS type %u\n", type);
+ GNUNET_break (0);
+ break;
+
+ }
+
+ }
+
+
+ if (address->session_id != session)
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Session changed from %u to %u\n", address->session_id, session);
+ address->session_id = session;
+ }
+ if (address->used != in_use)
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Usage changed from %u to %u\n", address->used, in_use);
+ address->used = in_use;
}
- /* Update quota for this network type */
- update_quota_per_network (s, c);
-#endif
}