From d34cadddefa8b4d216eb31c7123e6884497a11b6 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Tue, 27 May 2014 11:49:22 +0000 Subject: minor changes --- src/transport/gnunet-service-transport_clients.c | 1 + src/transport/test_plugin_transport.c | 3 ++- src/transport/test_transport_address_switch.c | 18 ++++++++++++++---- src/transport/transport_api_address_to_string.c | 3 +-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index 171644123..f3050b6e9 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c @@ -879,6 +879,7 @@ transmit_address_to_client (void *cls, const char *buf) else { len = sizeof (struct AddressToStringResultMessage); + atsm = GNUNET_malloc (len); atsm->header.size = ntohs (len); atsm->header.type = ntohs (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY); diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 1b58c8c73..39911863f 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c @@ -401,7 +401,8 @@ env_notify_address (void *cls, int add_remove, GNUNET_free(s2a); pretty_printers_running++; - api->address_pretty_printer (api->cls, address->transport_name, address->address, address->address_length, GNUNET_YES, + api->address_pretty_printer (api->cls, address->transport_name, + address->address, address->address_length, GNUNET_YES, GNUNET_TIME_UNIT_MINUTES, &address_pretty_printer_cb, w); if (GNUNET_OK != api->check_address (api->cls, w->address->address, w->address->address_length)) diff --git a/src/transport/test_transport_address_switch.c b/src/transport/test_transport_address_switch.c index 21dd417bf..fcbd798d0 100644 --- a/src/transport/test_transport_address_switch.c +++ b/src/transport/test_transport_address_switch.c @@ -228,9 +228,11 @@ clean_up () if (NULL != p1_stat) { GNUNET_STATISTICS_watch_cancel (p1_stat, "transport", - "# Attempts to switch addresses", stat_start_attempt_cb, p1); + "# Attempts to switch addresses", + stat_start_attempt_cb, p1); GNUNET_STATISTICS_watch_cancel (p1_stat, "transport", - "# Successful attempts to switch addresses", stat_success_attempt_cb, p1); + "# Successful attempts to switch addresses", + stat_success_attempt_cb, p1); GNUNET_STATISTICS_watch_cancel (p1_stat, "transport", "# Failed attempts to switch addresses (failed to send CONNECT CONT)", stat_fail_attempt_cb, p1); @@ -261,9 +263,9 @@ clean_up () GNUNET_STATISTICS_watch_cancel (p2_stat, "transport", "# Failed attempts to switch addresses (no response)", stat_fail_attempt_cb, p2); - GNUNET_STATISTICS_watch (p1_stat, "transport", + GNUNET_STATISTICS_watch (p2_stat, "transport", "# transport addresses", - stat_addresses_available, p1); + stat_addresses_available, p2); GNUNET_STATISTICS_destroy (p2_stat, GNUNET_NO); p2_stat = NULL; } @@ -313,7 +315,10 @@ end () FPRINTF (stderr, "Peer 1 tried %u times to switch and succeeded %u times, failed %u times\n", p1_switch_attempts, p1_switch_success, p1_switch_fail); if (p1_switch_success != p1_switch_attempts) + { + GNUNET_break (0); result ++; + } } else { @@ -325,7 +330,10 @@ end () FPRINTF (stderr, "Peer 2 tried %u times to switch and succeeded %u times, failed %u times\n", p2_switch_attempts, p2_switch_success, p2_switch_fail); if (p2_switch_success != p2_switch_attempts) + { + GNUNET_break (0); result ++; + } } else { @@ -337,12 +345,14 @@ end () (bytes_sent_after_switch == 0) ) { FPRINTF (stderr, "No data sent after switching!\n"); + GNUNET_break (0); res ++; } if ( ((p1_switch_attempts > 0) || (p2_switch_attempts > 0)) && (bytes_recv_after_switch == 0) ) { FPRINTF (stderr, "No data received after switching!\n"); + GNUNET_break (0); res ++; } diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c index f383a44b4..96b321dea 100644 --- a/src/transport/transport_api_address_to_string.c +++ b/src/transport/transport_api_address_to_string.c @@ -104,7 +104,7 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg) if (GNUNET_NO == result) { - alucb->cb (alucb->cb_cls, NULL, GNUNET_SYSERR); + alucb->cb (alucb->cb_cls, empty_str, GNUNET_SYSERR); /* expect more replies */ GNUNET_CLIENT_receive (alucb->client, &address_response_processor, alucb, @@ -112,7 +112,6 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg) return; } - address = (const char *) &atsm[1]; if ( (addr_len > (size - (sizeof (struct AddressToStringResultMessage)))) || (address[addr_len -1] != '\0') ) -- cgit v1.2.3