From a8935d6b9cd972429dc7b84b4d2f3b40896688de Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 7 Jun 2013 14:51:00 +0000 Subject: [PATCH] changes --- .../gnunet-service-ats-solver_proportional.c | 18 +++++++----------- src/ats/gnunet-service-ats_addresses.c | 7 +++++-- src/ats/gnunet-service-ats_addresses.h | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/ats/gnunet-service-ats-solver_proportional.c b/src/ats/gnunet-service-ats-solver_proportional.c index 8ddca1b27..119c97bf3 100644 --- a/src/ats/gnunet-service-ats-solver_proportional.c +++ b/src/ats/gnunet-service-ats-solver_proportional.c @@ -1315,17 +1315,15 @@ GAS_proportional_address_add (void *solver, uint32_t network); /** - * Updates a single address in the solver - * - * If ATS information was updated, the previous values are passed + * Updates a single address in the solver and checks previous values * * @param solver the solver Handle * @param addresses the address hashmap containing all addresses * @param address the update address - * @param session the new session (if changed otherwise current) - * @param in_use the new address in use state (if changed otherwise current) - * @param prev_ats ATS information - * @param prev_atsi_count the atsi count + * @param session the previous session + * @param in_use the previous address in use state + * @param prev_ats previous ATS information + * @param prev_atsi_count the previous atsi count */ void GAS_proportional_address_update (void *solver, @@ -1433,14 +1431,12 @@ GAS_proportional_address_update (void *solver, 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; + "Session changed from %u to %u\n", session, address->session_id); } 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; + "Usage changed from %u to %u\n", in_use, address->used); } } diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index ec0231350..5f10fed03 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c @@ -878,7 +878,6 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle, uint32_t atsi_delta_count; uint32_t prev_session; - if (GNUNET_NO == handle->running) return; @@ -917,6 +916,7 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle, prev_session = aa->session_id; aa->session_id = session_id; + /* Tell solver about update */ handle->s_update (handle->solver, handle->addresses, aa, prev_session, aa->used, atsi_delta, atsi_delta_count); GNUNET_free_non_null (atsi_delta); @@ -1104,6 +1104,7 @@ GAS_addresses_in_use (struct GAS_Addresses_Handle *handle, int in_use) { struct ATS_Address *ea; + int prev_inuse; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' for peer `%s'\n", @@ -1138,8 +1139,10 @@ GAS_addresses_in_use (struct GAS_Addresses_Handle *handle, } /* Tell solver about update */ - handle->s_update (handle->solver, handle->addresses, ea, session_id, in_use, NULL, 0); + prev_inuse = ea->used; ea->used = in_use; + handle->s_update (handle->solver, handle->addresses, ea, session_id, prev_inuse, NULL, 0); + return GNUNET_OK; } diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h index f6c85ab0d..3ec25600f 100644 --- a/src/ats/gnunet-service-ats_addresses.h +++ b/src/ats/gnunet-service-ats_addresses.h @@ -445,7 +445,7 @@ typedef void * @param addresses the address hashmap containing all addresses * @param address the address * @param session the previous session - * @param in_use address used: yes or no + * @param in_use previous address used state: yes or no * @param atsi ats previous performance information * @param atsi_count previous number of ats performance information * -- 2.25.1