From: LRN Date: Thu, 6 Dec 2012 01:34:18 +0000 (+0000) Subject: Don't crash when address suggestor fails X-Git-Tag: initial-import-from-subversion-38251~10598 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=41ae2321fbcd2719a76d2e6cc4d343c13845e41c;p=oweals%2Fgnunet.git Don't crash when address suggestor fails --- diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index b42fadb9b..605853b5b 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c @@ -775,19 +775,20 @@ GAS_addresses_request_address (const struct GNUNET_PeerIdentity *peer) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cannot suggest address for peer `%s'\n", GNUNET_i2s (peer)); else + { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Suggesting address %p for peer `%s'\n", aa, GNUNET_i2s (peer)); - ats_count = assemble_ats_information (aa, &ats); - GAS_scheduling_transmit_address_suggestion (peer, - aa->plugin, - aa->addr, aa->addr_len, - aa->session_id, - ats, ats_count, - aa->assigned_bw_out, - aa->assigned_bw_in); - GNUNET_free (ats); - + ats_count = assemble_ats_information (aa, &ats); + GAS_scheduling_transmit_address_suggestion (peer, + aa->plugin, + aa->addr, aa->addr_len, + aa->session_id, + ats, ats_count, + aa->assigned_bw_out, + aa->assigned_bw_in); + GNUNET_free (ats); + } } diff --git a/src/ats/gnunet-service-ats_addresses_simplistic.c b/src/ats/gnunet-service-ats_addresses_simplistic.c index 670b9edf2..201064c90 100644 --- a/src/ats/gnunet-service-ats_addresses_simplistic.c +++ b/src/ats/gnunet-service-ats_addresses_simplistic.c @@ -262,13 +262,15 @@ GAS_simplistic_get_preferred_address (void *solver, if (NULL == aa) LOG (GNUNET_ERROR_TYPE_DEBUG, "Cannot suggest address for peer `%s'\n", GNUNET_i2s (peer)); else + { LOG (GNUNET_ERROR_TYPE_DEBUG, "Suggesting address %p for peer `%s'\n", aa, GNUNET_i2s (peer)); - if (GNUNET_NO == aa->active) - { - aa->active = GNUNET_YES; - s->active_addresses++; - recalculate_assigned_bw (s, addresses); + if (GNUNET_NO == aa->active) + { + aa->active = GNUNET_YES; + s->active_addresses++; + recalculate_assigned_bw (s, addresses); + } } return aa;