- GNUNET_STATISTICS_set (handle->stat,
- "# addresses",
- GNUNET_CONTAINER_multipeermap_size (handle->addresses),
- GNUNET_NO);
-}
-
-
-/**
- * Notification about active use of an address.
- * in_use == #GNUNET_YES:
- * This address is used to maintain an active connection with a peer.
- * in_use == #GNUNET_NO:
- * This address is no longer used to maintain an active connection with a peer.
- *
- * Note: can only be called with in_use == #GNUNET_NO if called with #GNUNET_YES
- * before
- *
- * @param handle the address handle to use
- * @param peer peer
- * @param session_id session id, can be 0
- * @param in_use #GNUNET_YES if #GNUNET_NO FIXME
- * @return #GNUNET_SYSERR on failure (address unknown ...)
- */
-int
-GAS_addresses_in_use (struct GAS_Addresses_Handle *handle,
- const struct GNUNET_PeerIdentity *peer,
- uint32_t session_id,
- int in_use)
-{
- struct ATS_Address *ea;
-
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' for peer `%s'\n",
- "ADDRESS IN USE",
- GNUNET_i2s (peer));
- if (GNUNET_NO == handle->running)
- return GNUNET_SYSERR;
- ea = find_exact_address (handle,
- peer,
- session_id);
- if (NULL == ea)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Trying to set unknown address `%s' `%u' to %s \n",
- GNUNET_i2s (peer),
- session_id,
- (GNUNET_NO == in_use) ? "NO" : "YES");
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- if (ea->used == in_use)
- {
- GNUNET_break (0);
- GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
- "Address in use called multiple times for peer `%s': %s -> %s \n",
- GNUNET_i2s (peer),
- (GNUNET_NO == ea->used) ? "NO" : "YES",
- (GNUNET_NO == in_use) ? "NO" : "YES");
- return GNUNET_SYSERR;
- }
- /* Tell solver about update */
- ea->used = in_use;
- ea->t_last_activity = GNUNET_TIME_absolute_get();
- handle->env.sf.s_address_update_inuse (handle->solver,
- ea,
- ea->used);
- return GNUNET_OK;
-}
-
-
-/**
- * Cancel address suggestions for a peer
- *
- * @param handle the address handle
- * @param peer the peer id
- */
-void
-GAS_addresses_request_address_cancel (struct GAS_Addresses_Handle *handle,
- const struct GNUNET_PeerIdentity *peer)
-{
- struct GAS_Addresses_Suggestion_Requests *cur = handle->pending_requests_head;
-
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received request: `%s' for peer %s\n",
- "request_address_cancel", GNUNET_i2s (peer));
-
- while (NULL != cur)
- {
- if (0 == memcmp (peer, &cur->id, sizeof(cur->id)))
- break; /* found */
- cur = cur->next;
- }
-
- if (NULL == cur)
- {
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "No address requests pending for peer `%s', cannot remove!\n",
- GNUNET_i2s (peer));
- return;
- }
- handle->env.sf.s_get_stop (handle->solver, peer);
- GAS_addresses_handle_backoff_reset (handle, peer);
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Removed request pending for peer `%s\n",
- GNUNET_i2s (peer));
- GNUNET_CONTAINER_DLL_remove(handle->pending_requests_head, handle->pending_requests_tail, cur);
- GNUNET_free(cur);
-}
-
-
-/**
- * Request address suggestions for a peer
- *
- * @param handle the address handle
- * @param peer the peer id
- */
-void
-GAS_addresses_request_address (struct GAS_Addresses_Handle *handle,
- const struct GNUNET_PeerIdentity *peer)
-{
- struct GAS_Addresses_Suggestion_Requests *cur = handle->pending_requests_head;
- struct ATS_Address *aa;
-
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received `%s' for peer `%s'\n",
- "REQUEST ADDRESS", GNUNET_i2s (peer));
-
- if (GNUNET_NO == handle->running)
- return;
- while (NULL != cur)
- {
- if (0 == memcmp (peer, &cur->id, sizeof(cur->id)))
- break; /* already suggesting */
- cur = cur->next;
- }
- if (NULL == cur)
- {
- cur = GNUNET_new (struct GAS_Addresses_Suggestion_Requests);
- cur->id = (*peer);
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Adding new address suggestion request for `%s'\n",
- GNUNET_i2s (peer));
- GNUNET_CONTAINER_DLL_insert(handle->pending_requests_head, handle->pending_requests_tail, cur);
- }
-
- /* Get prefered address from solver */
- aa = (struct ATS_Address *) handle->env.sf.s_get (handle->solver, peer);
- if (NULL == aa)
- {
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Cannot suggest address for peer `%s'\n",
- GNUNET_i2s (peer));
- return;
- }
-
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Suggesting address %p for peer `%s'\n",
- aa, GNUNET_i2s (peer));
-
- GAS_scheduling_transmit_address_suggestion (peer,
- aa->session_id,
- GNUNET_BANDWIDTH_value_init (aa->assigned_bw_out),
- GNUNET_BANDWIDTH_value_init (aa->assigned_bw_in));
-
- aa->block_interval = GNUNET_TIME_relative_add (aa->block_interval,
- ATS_BLOCKING_DELTA);
- aa->blocked_until = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
- aa->block_interval);
-
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Address %p ready for suggestion, block interval now %llu \n", aa,
- aa->block_interval);
-}
-
-/**
- * Iterator to reset address blocking
- *
- * @param cls not used
- * @param key the peer
- * @param value the address to reset
- * @return #GNUNET_OK to continue
- */
-static int
-reset_address_it (void *cls,
- const struct GNUNET_PeerIdentity *key,
- void *value)
-{
- struct ATS_Address *aa = value;
-
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Resetting interval for peer `%s' address %p from %llu to 0\n",
- GNUNET_i2s (&aa->peer),
- aa,
- aa->block_interval);
- aa->blocked_until = GNUNET_TIME_UNIT_ZERO_ABS;
- aa->block_interval = GNUNET_TIME_UNIT_ZERO;
- return GNUNET_OK;
-}
-
-
-/**
- * Reset suggestion backoff for a peer
- *
- * Suggesting addresses is blocked for ATS_BLOCKING_DELTA. Blocking can be
- * reset using this function
- *
- * @param handle the address handle
- * @param peer the peer id
- */
-void
-GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle,
- const struct GNUNET_PeerIdentity *peer)
-{
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received `%s' for peer `%s'\n",
- "RESET BACKOFF", GNUNET_i2s (peer));
-
- GNUNET_break(
- GNUNET_SYSERR != GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses,
- peer,
- &reset_address_it, NULL));
-}
-
-
-/**
- * Solver information callback
- *
- * @param cls the closure
- * @param op the operation
- * @param stat operation status
- * @param add additional information
- */
-
-static void
-solver_info_cb (void *cls,
- enum GAS_Solver_Operation op,
- enum GAS_Solver_Status stat,
- enum GAS_Solver_Additional_Information add)
-{
- char *add_info;
-
- switch (add) {
- case GAS_INFO_NONE:
- add_info = "GAS_INFO_NONE";
- break;
- case GAS_INFO_FULL:
- add_info = "GAS_INFO_MLP_FULL";
- break;
- case GAS_INFO_UPDATED:
- add_info = "GAS_INFO_MLP_UPDATED";
- break;
- case GAS_INFO_PROP_ALL:
- add_info = "GAS_INFO_PROP_ALL";
- break;
- case GAS_INFO_PROP_SINGLE:
- add_info = "GAS_INFO_PROP_SINGLE";
- break;
- default:
- add_info = "INVALID";
- break;
- }
- switch (op)
- {
- case GAS_OP_SOLVE_START:
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Solver notifies `%s' with result `%s' `%s'\n", "GAS_OP_SOLVE_START",
- (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL", add_info);
- return;
- case GAS_OP_SOLVE_STOP:
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Solver notifies `%s' with result `%s'\n", "GAS_OP_SOLVE_STOP",
- (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL", add_info);
- return;
-
- case GAS_OP_SOLVE_SETUP_START:
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Solver notifies `%s' with result `%s'\n", "GAS_OP_SOLVE_SETUP_START",
- (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
- return;
-
- case GAS_OP_SOLVE_SETUP_STOP:
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Solver notifies `%s' with result `%s'\n", "GAS_OP_SOLVE_SETUP_STOP",
- (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
- return;
-
- case GAS_OP_SOLVE_MLP_LP_START:
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Solver notifies `%s' with result `%s'\n", "GAS_OP_SOLVE_LP_START",
- (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
- return;
- case GAS_OP_SOLVE_MLP_LP_STOP:
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Solver notifies `%s' with result `%s'\n", "GAS_OP_SOLVE_LP_STOP",
- (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
- return;
-
- case GAS_OP_SOLVE_MLP_MLP_START:
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Solver notifies `%s' with result `%s'\n", "GAS_OP_SOLVE_MLP_START",
- (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
- return;
- case GAS_OP_SOLVE_MLP_MLP_STOP:
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Solver notifies `%s' with result `%s'\n", "GAS_OP_SOLVE_MLP_STOP",
- (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
- return;
- case GAS_OP_SOLVE_UPDATE_NOTIFICATION_START:
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Solver notifies `%s' with result `%s'\n", "GAS_OP_SOLVE_UPDATE_NOTIFICATION_START",
- (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
- return;
- case GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP:
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Solver notifies `%s' with result `%s'\n", "GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP",
- (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
- return;
- default:
- break;
- }
-}
-
-
-/**
- * The preference changed for a peer
- *
- * @param cls the address handle
- * @param peer the peer
- * @param kind the ATS kind
- * @param pref_rel the new relative preference value
- */
-static void
-normalized_preference_changed_cb (void *cls,
- const struct GNUNET_PeerIdentity *peer, enum GNUNET_ATS_PreferenceKind kind,
- double pref_rel)
-{
- GNUNET_assert(NULL != cls);
- struct GAS_Addresses_Handle *handle = cls;
-
- /* Tell solver about update */
- handle->env.sf.s_pref (handle->solver, peer, kind, pref_rel);
-}
-
-/**
- * The relative value for a property changed
- *
- * @param cls the address handle
- * @param address the peer
- * @param type the ATS type
- * @param prop_rel the new relative preference value
- */
-static void
-normalized_property_changed_cb (void *cls, struct ATS_Address *address,
- uint32_t type, double prop_rel)
-{
- struct GAS_Addresses_Handle *ah = (struct GAS_Addresses_Handle *) cls;
- GNUNET_assert(NULL != ah);
-
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Normalized property %s for peer `%s' changed to %.3f \n",
- GNUNET_ATS_print_property_type (type), GNUNET_i2s (&address->peer),
- prop_rel);
-
- ah->env.sf.s_address_update_property (ah->solver, address, type, 0, prop_rel);
-}
-
-static struct GAS_Addresses_Preference_Clients *
-find_preference_client (struct GAS_Addresses_Handle *handle, void *client)
-{
- struct GAS_Addresses_Preference_Clients *cur;
-
- for (cur = handle->preference_clients_head; NULL != cur; cur = cur->next)
- {
- if (cur->client == client)
- return cur;
- }
- return NULL;
-}
-
-
-/**
- * A performance client disconnected
- *
- * @param handle address handle
- * @param client the client
- */
-void
-GAS_addresses_preference_client_disconnect (struct GAS_Addresses_Handle *handle,
- void *client)
-{
- struct GAS_Addresses_Preference_Clients * pc;
- if (NULL != (pc = find_preference_client (handle, client)))
- {
- GNUNET_CONTAINER_DLL_remove (handle->preference_clients_head,
- handle->preference_clients_tail, pc);
- GNUNET_free (pc);
- GNUNET_assert (handle->pref_clients > 0);
- handle->pref_clients --;
- GNUNET_STATISTICS_set (handle->stat, "# active performance clients", handle->pref_clients, GNUNET_NO);
- }
- GAS_normalization_preference_client_disconnect (client);
-}
-
-
-/**
- * Change the preference for a peer
- *
- * @param handle the address handle
- * @param client the client sending this request
- * @param peer the peer id
- * @param kind the preference kind to change
- * @param score_abs the new preference score
- */
-void
-GAS_addresses_preference_change (struct GAS_Addresses_Handle *handle,
- void *client, const struct GNUNET_PeerIdentity *peer,
- enum GNUNET_ATS_PreferenceKind kind, float score_abs)
-{
- struct GAS_Addresses_Preference_Clients * pc;
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' for peer `%s' for client %p\n", "CHANGE PREFERENCE",
- GNUNET_i2s (peer), client);
-
- if (GNUNET_NO == handle->running)
- return;
-
- if (GNUNET_NO ==
- GNUNET_CONTAINER_multipeermap_contains (handle->addresses,
- peer))
- {
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' for unknown peer `%s' from client %p\n",
- "CHANGE PREFERENCE", GNUNET_i2s (peer), client);
- return;
- }
-
- if (NULL == find_preference_client (handle, client))
- {
- pc = GNUNET_new (struct GAS_Addresses_Preference_Clients);
- pc->client = client;
- GNUNET_CONTAINER_DLL_insert (handle->preference_clients_head,
- handle->preference_clients_tail, pc);
- handle->pref_clients ++;
- GNUNET_STATISTICS_set (handle->stat,
- "# active performance clients",
- handle->pref_clients,
- GNUNET_NO);
- }
-
- handle->env.sf.s_bulk_start (handle->solver);
- /* Tell normalization about change, normalization will call callback if preference changed */
- GAS_normalization_normalize_preference (client, peer, kind, score_abs);
- handle->env.sf.s_bulk_stop (handle->solver);
-}
-
-
-/**
- * Change the preference for a peer
- *
- * @param handle the address handle
- * @param application the client sending this request
- * @param peer the peer id
- * @param scope the time interval for this feedback: [now - scope .. now]
- * @param kind the preference kind to change
- * @param score_abs the new preference score
- */
-void
-GAS_addresses_preference_feedback (struct GAS_Addresses_Handle *handle,
- void *application,
- const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_TIME_Relative scope,
- enum GNUNET_ATS_PreferenceKind kind,
- float score_abs)
-{
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' for peer `%s' for client %p\n", "PREFERENCE FEEDBACK",
- GNUNET_i2s (peer), application);
-
- if (GNUNET_NO == handle->running)
- return;
-
- if (GNUNET_NO ==
- GNUNET_CONTAINER_multipeermap_contains (handle->addresses,
- peer))
- {
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' for unknown peer `%s' from client %p\n",
- "PREFERENCE FEEDBACK", GNUNET_i2s (peer), application);
- return;
- }
-
- handle->env.sf.s_feedback (handle->solver, application, peer, scope, kind,
- score_abs);
-}
-
-
-/**
- * Load quotas for networks from configuration
- *
- * @param cfg configuration handle
- * @param out_dest where to write outbound quotas
- * @param in_dest where to write inbound quotas
- * @param dest_length length of inbound and outbound arrays
- * @return number of networks loaded
- */
-static unsigned int
-load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
- unsigned long long *out_dest, unsigned long long *in_dest, int dest_length)
-{
- char * entry_in = NULL;
- char * entry_out = NULL;
- char * quota_out_str;
- char * quota_in_str;
- int c;
- int res;
-
- for (c = 0; (c < GNUNET_ATS_NetworkTypeCount) && (c < dest_length); c++)
- {
- in_dest[c] = 0;
- out_dest[c] = 0;
- GNUNET_asprintf (&entry_out,
- "%s_QUOTA_OUT",
- GNUNET_ATS_print_network_type (c));
- GNUNET_asprintf (&entry_in,
- "%s_QUOTA_IN",
- GNUNET_ATS_print_network_type (c));
-
- /* quota out */
- if (GNUNET_OK
- == GNUNET_CONFIGURATION_get_value_string (cfg, "ats", entry_out,
- "a_out_str))
- {
- res = GNUNET_NO;
- if (0 == strcmp (quota_out_str, GNUNET_ATS_MaxBandwidthString))
- {
- out_dest[c] = GNUNET_ATS_MaxBandwidth;
- res = GNUNET_YES;
- }
- if ((GNUNET_NO == res)
- && (GNUNET_OK
- == GNUNET_STRINGS_fancy_size_to_bytes (quota_out_str,
- &out_dest[c])))
- res = GNUNET_YES;
- if ((GNUNET_NO == res)
- && (GNUNET_OK
- == GNUNET_CONFIGURATION_get_value_number (cfg, "ats", entry_out,
- &out_dest[c])))
- res = GNUNET_YES;
-
- if (GNUNET_NO == res)
- {
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"),
- GNUNET_ATS_print_network_type (c),
- quota_out_str,
- GNUNET_ATS_DefaultBandwidth);
- out_dest[c] = GNUNET_ATS_DefaultBandwidth;
- }
- else
- {
- GNUNET_log(GNUNET_ERROR_TYPE_INFO,
- _("Outbound quota configure for network `%s' is %llu\n"),
- GNUNET_ATS_print_network_type (c),
- out_dest[c]);
- }
- GNUNET_free(quota_out_str);
- }
- else
- {
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- _("No outbound quota configured for network `%s', assigning default bandwidth %llu\n"),
- GNUNET_ATS_print_network_type (c),
- GNUNET_ATS_DefaultBandwidth);
- out_dest[c] = GNUNET_ATS_DefaultBandwidth;
- }
-
- /* quota in */
- if (GNUNET_OK
- == GNUNET_CONFIGURATION_get_value_string (cfg, "ats", entry_in,
- "a_in_str))
- {
- res = GNUNET_NO;
- if (0 == strcmp (quota_in_str, GNUNET_ATS_MaxBandwidthString))
- {
- in_dest[c] = GNUNET_ATS_MaxBandwidth;
- res = GNUNET_YES;
- }
- if ((GNUNET_NO == res)
- && (GNUNET_OK
- == GNUNET_STRINGS_fancy_size_to_bytes (quota_in_str, &in_dest[c])))
- res = GNUNET_YES;
- if ((GNUNET_NO == res)
- && (GNUNET_OK
- == GNUNET_CONFIGURATION_get_value_number (cfg, "ats", entry_in,
- &in_dest[c])))
- res = GNUNET_YES;
-
- if (GNUNET_NO == res)
- {
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"),
- GNUNET_ATS_print_network_type (c),
- quota_in_str,
- GNUNET_ATS_DefaultBandwidth);
- in_dest[c] = GNUNET_ATS_DefaultBandwidth;
- }
- else
- {
- GNUNET_log(GNUNET_ERROR_TYPE_INFO,
- _("Inbound quota configured for network `%s' is %llu\n"),
- GNUNET_ATS_print_network_type (c),
- in_dest[c]);
- }
- GNUNET_free(quota_in_str);
- }
- else
- {
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- _("No outbound quota configure for network `%s', assigning default bandwidth %llu\n"),
- GNUNET_ATS_print_network_type (c),
- GNUNET_ATS_DefaultBandwidth);
- in_dest[c] = GNUNET_ATS_DefaultBandwidth;
- }
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Loaded quota for network `%s' (in/out): %llu %llu\n",
- GNUNET_ATS_print_network_type (c),
- in_dest[c],
- out_dest[c]);
- GNUNET_free(entry_out);
- GNUNET_free(entry_in);
- }
- return GNUNET_ATS_NetworkTypeCount;
-}
-
-
-/**
- * Callback for solver to notify about assignment changes
- *
- * @param cls the GAS_Addresses_Handle
- * @param address the address with changes
- */
-static void
-bandwidth_changed_cb (void *cls, struct ATS_Address *address)
-{
- struct GAS_Addresses_Handle *handle = cls;
- struct GAS_Addresses_Suggestion_Requests *cur;
- uint32_t diff_out;
- uint32_t diff_in;
-
- GNUNET_assert(handle != NULL);
- GNUNET_assert(address != NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Bandwidth assignment changed for peer %s \n",
- GNUNET_i2s (&address->peer));
-
- /* Notify performance clients about changes to address */
- GAS_performance_notify_all_clients (&address->peer, address->plugin,
- address->addr, address->addr_len, address->active, address->atsi,
- address->atsi_count,
- GNUNET_BANDWIDTH_value_init (address->assigned_bw_out),
- GNUNET_BANDWIDTH_value_init (address->assigned_bw_in));
-
- cur = handle->pending_requests_head;
- while (NULL != cur)
- {
- if (0 == memcmp (&address->peer, &cur->id, sizeof(cur->id)))
- break; /* we have an address request pending*/
- cur = cur->next;
- }
- if (NULL == cur)
- {
- GNUNET_log(GNUNET_ERROR_TYPE_INFO,
- "Nobody is interested in peer `%s' :(\n",
- GNUNET_i2s (&address->peer));
- return;
- }
-
- if ((0 == address->assigned_bw_in) && (0 == address->assigned_bw_out))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Telling transport to disconnect peer `%s'\n",
- GNUNET_i2s (&address->peer));
-
- /* Notify scheduling clients about suggestion */
- GAS_scheduling_transmit_address_suggestion (&address->peer,
- address->session_id,
- GNUNET_BANDWIDTH_value_init (0),
- GNUNET_BANDWIDTH_value_init (0));
- return;
- }
-
- /* Do bandwidth stability check */
- diff_out = abs (address->assigned_bw_out - address->last_notified_bw_out);
- diff_in = abs (address->assigned_bw_in - address->last_notified_bw_in);
-
- if ( (diff_out < htonl(GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__)) &&
- (diff_in < htonl(GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__)) )
- return;
-
- GNUNET_log(GNUNET_ERROR_TYPE_INFO,
- "Sending bandwidth update for peer `%s': %u %u\n",
- GNUNET_i2s (&address->peer), address->assigned_bw_out,
- address->assigned_bw_out);
-
- /* *Notify scheduling clients about suggestion */
- GAS_scheduling_transmit_address_suggestion (&address->peer,
- address->session_id,
- GNUNET_BANDWIDTH_value_init (address->assigned_bw_out),
- GNUNET_BANDWIDTH_value_init (address->assigned_bw_in));
-
- address->last_notified_bw_out = address->assigned_bw_out;
- address->last_notified_bw_in = address->assigned_bw_in;