aboutsummaryrefslogtreecommitdiff
path: root/src/ats/ats_api_performance.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-16 10:10:59 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-16 10:10:59 +0000
commit1eef01cd60f92a3d77061d655c0217bd6f9ffce4 (patch)
treedb83ba950eb0ece1efb9b682e379ccd1d0dd4b72 /src/ats/ats_api_performance.c
parentc1d89ed3cf92fa2492a5639e725aadd74742f135 (diff)
downloadgnunet-1eef01cd60f92a3d77061d655c0217bd6f9ffce4.tar.gz
gnunet-1eef01cd60f92a3d77061d655c0217bd6f9ffce4.zip
notify performance monitors about destroyed addresses (for #3406)
Diffstat (limited to 'src/ats/ats_api_performance.c')
-rw-r--r--src/ats/ats_api_performance.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
index 35dcc558f..ab242a0e9 100644
--- a/src/ats/ats_api_performance.c
+++ b/src/ats/ats_api_performance.c
@@ -367,7 +367,7 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph,
367 ats_count = ntohl (pi->ats_count); 367 ats_count = ntohl (pi->ats_count);
368 plugin_address_length = ntohs (pi->address_length); 368 plugin_address_length = ntohs (pi->address_length);
369 plugin_name_length = ntohs (pi->plugin_name_length); 369 plugin_name_length = ntohs (pi->plugin_name_length);
370 addr_active = ntohl (pi->address_active); 370 addr_active = (int) ntohl (pi->address_active);
371 atsi = (const struct GNUNET_ATS_Information *) &pi[1]; 371 atsi = (const struct GNUNET_ATS_Information *) &pi[1];
372 plugin_address = (const char *) &atsi[ats_count]; 372 plugin_address = (const char *) &atsi[ats_count];
373 plugin_name = &plugin_address[plugin_address_length]; 373 plugin_name = &plugin_address[plugin_address_length];
@@ -389,7 +389,6 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph,
389 address.address = plugin_address; 389 address.address = plugin_address;
390 address.address_length = plugin_address_length; 390 address.address_length = plugin_address_length;
391 address.transport_name = plugin_name; 391 address.transport_name = plugin_name;
392
393 ph->addr_info_cb (ph->addr_info_cb_cls, 392 ph->addr_info_cb (ph->addr_info_cb_cls,
394 &address, 393 &address,
395 addr_active, 394 addr_active,
@@ -482,8 +481,9 @@ process_ar_message (struct GNUNET_ATS_PerformanceHandle *ph,
482 GNUNET_break(0); 481 GNUNET_break(0);
483 return GNUNET_SYSERR; 482 return GNUNET_SYSERR;
484 } 483 }
485 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, _("Received %s message\n"), 484 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
486 "ATS_ADDRESSLIST_RESPONSE"); 485 _("Received %s message\n"),
486 "ATS_ADDRESSLIST_RESPONSE");
487 487
488 pi = (const struct PeerInformationMessage *) msg; 488 pi = (const struct PeerInformationMessage *) msg;
489 id = ntohl (pi->id); 489 id = ntohl (pi->id);
@@ -560,7 +560,8 @@ process_ar_message (struct GNUNET_ATS_PerformanceHandle *ph,
560 * @param msg message received, NULL on timeout or fatal error 560 * @param msg message received, NULL on timeout or fatal error
561 */ 561 */
562static void 562static void
563process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg) 563process_ats_message (void *cls,
564 const struct GNUNET_MessageHeader *msg)
564{ 565{
565 struct GNUNET_ATS_PerformanceHandle *ph = cls; 566 struct GNUNET_ATS_PerformanceHandle *ph = cls;
566 567
@@ -649,7 +650,7 @@ reconnect (struct GNUNET_ATS_PerformanceHandle *ph)
649 * @param cfg configuration to use 650 * @param cfg configuration to use
650 * @param addr_info_cb callback called when performance characteristics for 651 * @param addr_info_cb callback called when performance characteristics for
651 * an address change 652 * an address change
652 * @param addr_info_cb_cls closure for infocb 653 * @param addr_info_cb_cls closure for @a addr_info_cb
653 * @return ats performance context 654 * @return ats performance context
654 */ 655 */
655struct GNUNET_ATS_PerformanceHandle * 656struct GNUNET_ATS_PerformanceHandle *
@@ -778,7 +779,7 @@ GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc)
778 * 779 *
779 * @param handle the performance handle to use 780 * @param handle the performance handle to use
780 * @param peer peer idm can be NULL for all peers 781 * @param peer peer idm can be NULL for all peers
781 * @param all GNUNET_YES to get information about all addresses or GNUNET_NO to 782 * @param all #GNUNET_YES to get information about all addresses or #GNUNET_NO to
782 * get only address currently used 783 * get only address currently used
783 * @param infocb callback to call with the addresses, 784 * @param infocb callback to call with the addresses,
784 * will callback with address == NULL when done 785 * will callback with address == NULL when done
@@ -832,8 +833,9 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *hand
832 { 833 {
833 memset (&m->peer, '\0', sizeof(struct GNUNET_PeerIdentity)); 834 memset (&m->peer, '\0', sizeof(struct GNUNET_PeerIdentity));
834 } 835 }
835 GNUNET_CONTAINER_DLL_insert_tail(handle->pending_head, handle->pending_tail, 836 GNUNET_CONTAINER_DLL_insert_tail(handle->pending_head,
836 p); 837 handle->pending_tail,
838 p);
837 839
838 do_transmit (handle); 840 do_transmit (handle);
839 841
@@ -849,11 +851,11 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *hand
849void 851void
850GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressListHandle *handle) 852GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressListHandle *handle)
851{ 853{
852 GNUNET_assert(NULL != handle); 854 GNUNET_assert (NULL != handle);
853 855 GNUNET_CONTAINER_DLL_remove (handle->ph->addresslist_head,
854 GNUNET_CONTAINER_DLL_remove(handle->ph->addresslist_head, 856 handle->ph->addresslist_tail,
855 handle->ph->addresslist_tail, handle); 857 handle);
856 GNUNET_free(handle); 858 GNUNET_free (handle);
857} 859}
858 860
859 861