aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-05-27 11:49:22 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-05-27 11:49:22 +0000
commitd34cadddefa8b4d216eb31c7123e6884497a11b6 (patch)
tree0acabc3970020efb21c1cf49e199eb4290b1ee8a
parent2cecee44de434344273c797e6db4878a81e2f6fa (diff)
downloadgnunet-d34cadddefa8b4d216eb31c7123e6884497a11b6.tar.gz
gnunet-d34cadddefa8b4d216eb31c7123e6884497a11b6.zip
minor changes
-rw-r--r--src/transport/gnunet-service-transport_clients.c1
-rw-r--r--src/transport/test_plugin_transport.c3
-rw-r--r--src/transport/test_transport_address_switch.c18
-rw-r--r--src/transport/transport_api_address_to_string.c3
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)
879 else 879 else
880 { 880 {
881 len = sizeof (struct AddressToStringResultMessage); 881 len = sizeof (struct AddressToStringResultMessage);
882
882 atsm = GNUNET_malloc (len); 883 atsm = GNUNET_malloc (len);
883 atsm->header.size = ntohs (len); 884 atsm->header.size = ntohs (len);
884 atsm->header.type = ntohs (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY); 885 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,
401 GNUNET_free(s2a); 401 GNUNET_free(s2a);
402 402
403 pretty_printers_running++; 403 pretty_printers_running++;
404 api->address_pretty_printer (api->cls, address->transport_name, address->address, address->address_length, GNUNET_YES, 404 api->address_pretty_printer (api->cls, address->transport_name,
405 address->address, address->address_length, GNUNET_YES,
405 GNUNET_TIME_UNIT_MINUTES, &address_pretty_printer_cb, w); 406 GNUNET_TIME_UNIT_MINUTES, &address_pretty_printer_cb, w);
406 407
407 if (GNUNET_OK != api->check_address (api->cls, w->address->address, w->address->address_length)) 408 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 ()
228 if (NULL != p1_stat) 228 if (NULL != p1_stat)
229 { 229 {
230 GNUNET_STATISTICS_watch_cancel (p1_stat, "transport", 230 GNUNET_STATISTICS_watch_cancel (p1_stat, "transport",
231 "# Attempts to switch addresses", stat_start_attempt_cb, p1); 231 "# Attempts to switch addresses",
232 stat_start_attempt_cb, p1);
232 GNUNET_STATISTICS_watch_cancel (p1_stat, "transport", 233 GNUNET_STATISTICS_watch_cancel (p1_stat, "transport",
233 "# Successful attempts to switch addresses", stat_success_attempt_cb, p1); 234 "# Successful attempts to switch addresses",
235 stat_success_attempt_cb, p1);
234 GNUNET_STATISTICS_watch_cancel (p1_stat, "transport", 236 GNUNET_STATISTICS_watch_cancel (p1_stat, "transport",
235 "# Failed attempts to switch addresses (failed to send CONNECT CONT)", 237 "# Failed attempts to switch addresses (failed to send CONNECT CONT)",
236 stat_fail_attempt_cb, p1); 238 stat_fail_attempt_cb, p1);
@@ -261,9 +263,9 @@ clean_up ()
261 GNUNET_STATISTICS_watch_cancel (p2_stat, "transport", 263 GNUNET_STATISTICS_watch_cancel (p2_stat, "transport",
262 "# Failed attempts to switch addresses (no response)", 264 "# Failed attempts to switch addresses (no response)",
263 stat_fail_attempt_cb, p2); 265 stat_fail_attempt_cb, p2);
264 GNUNET_STATISTICS_watch (p1_stat, "transport", 266 GNUNET_STATISTICS_watch (p2_stat, "transport",
265 "# transport addresses", 267 "# transport addresses",
266 stat_addresses_available, p1); 268 stat_addresses_available, p2);
267 GNUNET_STATISTICS_destroy (p2_stat, GNUNET_NO); 269 GNUNET_STATISTICS_destroy (p2_stat, GNUNET_NO);
268 p2_stat = NULL; 270 p2_stat = NULL;
269 } 271 }
@@ -313,7 +315,10 @@ end ()
313 FPRINTF (stderr, "Peer 1 tried %u times to switch and succeeded %u times, failed %u times\n", 315 FPRINTF (stderr, "Peer 1 tried %u times to switch and succeeded %u times, failed %u times\n",
314 p1_switch_attempts, p1_switch_success, p1_switch_fail); 316 p1_switch_attempts, p1_switch_success, p1_switch_fail);
315 if (p1_switch_success != p1_switch_attempts) 317 if (p1_switch_success != p1_switch_attempts)
318 {
319 GNUNET_break (0);
316 result ++; 320 result ++;
321 }
317 } 322 }
318 else 323 else
319 { 324 {
@@ -325,7 +330,10 @@ end ()
325 FPRINTF (stderr, "Peer 2 tried %u times to switch and succeeded %u times, failed %u times\n", 330 FPRINTF (stderr, "Peer 2 tried %u times to switch and succeeded %u times, failed %u times\n",
326 p2_switch_attempts, p2_switch_success, p2_switch_fail); 331 p2_switch_attempts, p2_switch_success, p2_switch_fail);
327 if (p2_switch_success != p2_switch_attempts) 332 if (p2_switch_success != p2_switch_attempts)
333 {
334 GNUNET_break (0);
328 result ++; 335 result ++;
336 }
329 } 337 }
330 else 338 else
331 { 339 {
@@ -337,12 +345,14 @@ end ()
337 (bytes_sent_after_switch == 0) ) 345 (bytes_sent_after_switch == 0) )
338 { 346 {
339 FPRINTF (stderr, "No data sent after switching!\n"); 347 FPRINTF (stderr, "No data sent after switching!\n");
348 GNUNET_break (0);
340 res ++; 349 res ++;
341 } 350 }
342 if ( ((p1_switch_attempts > 0) || (p2_switch_attempts > 0)) && 351 if ( ((p1_switch_attempts > 0) || (p2_switch_attempts > 0)) &&
343 (bytes_recv_after_switch == 0) ) 352 (bytes_recv_after_switch == 0) )
344 { 353 {
345 FPRINTF (stderr, "No data received after switching!\n"); 354 FPRINTF (stderr, "No data received after switching!\n");
355 GNUNET_break (0);
346 res ++; 356 res ++;
347 } 357 }
348 358
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)
104 104
105 if (GNUNET_NO == result) 105 if (GNUNET_NO == result)
106 { 106 {
107 alucb->cb (alucb->cb_cls, NULL, GNUNET_SYSERR); 107 alucb->cb (alucb->cb_cls, empty_str, GNUNET_SYSERR);
108 108
109 /* expect more replies */ 109 /* expect more replies */
110 GNUNET_CLIENT_receive (alucb->client, &address_response_processor, alucb, 110 GNUNET_CLIENT_receive (alucb->client, &address_response_processor, alucb,
@@ -112,7 +112,6 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg)
112 return; 112 return;
113 } 113 }
114 114
115
116 address = (const char *) &atsm[1]; 115 address = (const char *) &atsm[1];
117 if ( (addr_len > (size - (sizeof (struct AddressToStringResultMessage)))) || 116 if ( (addr_len > (size - (sizeof (struct AddressToStringResultMessage)))) ||
118 (address[addr_len -1] != '\0') ) 117 (address[addr_len -1] != '\0') )