diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-05-21 12:39:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-05-21 12:39:37 +0000 |
commit | 56b0f68b2fb5b2578faf8fdc5bed5ef9ae236f03 (patch) | |
tree | 41d75113aec81fc6ed125f1c520ac5b33bdb5e2a /src/transport/test_plugin_transport.c | |
parent | aa24a07a4e5411a2e3e9dc4158232b92b7e90927 (diff) | |
download | gnunet-56b0f68b2fb5b2578faf8fdc5bed5ef9ae236f03.tar.gz gnunet-56b0f68b2fb5b2578faf8fdc5bed5ef9ae236f03.zip |
-fixes to error reporting
Diffstat (limited to 'src/transport/test_plugin_transport.c')
-rw-r--r-- | src/transport/test_plugin_transport.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 9b1760919..8dde5c10b 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c | |||
@@ -163,7 +163,7 @@ end () | |||
163 | { | 163 | { |
164 | w = head; | 164 | w = head; |
165 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 165 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
166 | _("Plugin did not remove address `%s' \n"), w->addrstring); | 166 | "Plugin did not remove address `%s'\n", w->addrstring); |
167 | GNUNET_CONTAINER_DLL_remove (head, tail, w); | 167 | GNUNET_CONTAINER_DLL_remove (head, tail, w); |
168 | c ++; | 168 | c ++; |
169 | GNUNET_free (w->addr); | 169 | GNUNET_free (w->addr); |
@@ -174,7 +174,7 @@ end () | |||
174 | { | 174 | { |
175 | GNUNET_break (0); | 175 | GNUNET_break (0); |
176 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 176 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
177 | _("Plugin did not remove %u addresses \n"), c); | 177 | "Plugin did not remove %u addresses \n", c); |
178 | ok = 1; | 178 | ok = 1; |
179 | } | 179 | } |
180 | 180 | ||
@@ -208,14 +208,14 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
208 | { | 208 | { |
209 | timeout_endbadly = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &end_badly, &ok); | 209 | timeout_endbadly = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &end_badly, &ok); |
210 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 210 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
211 | _("Have pending calls to pretty_printer ... deferring shutdown\n")); | 211 | "Have pending calls to pretty_printer ... deferring shutdown\n"); |
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | 214 | ||
215 | if (NULL != cls) | 215 | if (NULL != cls) |
216 | { | 216 | { |
217 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 217 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
218 | _("Test took too long to execute, timeout .... \n")); | 218 | "Test took too long to execute, timeout .... \n"); |
219 | } | 219 | } |
220 | 220 | ||
221 | if (NULL != libname) | 221 | if (NULL != libname) |
@@ -230,7 +230,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
230 | { | 230 | { |
231 | w = head; | 231 | w = head; |
232 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 232 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
233 | _("Plugin did not remove address `%s' \n"), w->addrstring); | 233 | "Plugin did not remove address `%s'\n", w->addrstring); |
234 | GNUNET_CONTAINER_DLL_remove (head, tail, w); | 234 | GNUNET_CONTAINER_DLL_remove (head, tail, w); |
235 | c ++; | 235 | c ++; |
236 | GNUNET_free (w->addr); | 236 | GNUNET_free (w->addr); |
@@ -241,7 +241,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
241 | { | 241 | { |
242 | GNUNET_break (0); | 242 | GNUNET_break (0); |
243 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 243 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
244 | _("Plugin did not remove %u addresses \n"), c); | 244 | "Plugin did not remove %u addresses\n", c); |
245 | } | 245 | } |
246 | 246 | ||
247 | if (NULL != stats) | 247 | if (NULL != stats) |
@@ -266,7 +266,7 @@ wait_end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
266 | timeout_wait = GNUNET_SCHEDULER_NO_TASK; | 266 | timeout_wait = GNUNET_SCHEDULER_NO_TASK; |
267 | if (0 == addresses_reported) | 267 | if (0 == addresses_reported) |
268 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 268 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
269 | _("Plugin did not report any addresses, could not check address conversion functions\n")); | 269 | "Plugin did not report any addresses, could not check address conversion functions\n"); |
270 | end (); | 270 | end (); |
271 | } | 271 | } |
272 | 272 | ||
@@ -349,7 +349,7 @@ env_notify_address (void *cls, | |||
349 | { | 349 | { |
350 | addresses_reported ++; | 350 | addresses_reported ++; |
351 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 351 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
352 | _("Adding address of length %u\n"), addrlen); | 352 | "Adding address of length %u\n", addrlen); |
353 | 353 | ||
354 | w = GNUNET_malloc (sizeof (struct AddressWrapper)); | 354 | w = GNUNET_malloc (sizeof (struct AddressWrapper)); |
355 | w->addr = GNUNET_malloc (addrlen); | 355 | w->addr = GNUNET_malloc (addrlen); |
@@ -368,19 +368,19 @@ env_notify_address (void *cls, | |||
368 | { | 368 | { |
369 | GNUNET_break (0); | 369 | GNUNET_break (0); |
370 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 370 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
371 | _("Plugin cannot convert address to string!\n")); | 371 | "Plugin cannot convert address to string!\n"); |
372 | end_badly_now(); | 372 | end_badly_now(); |
373 | return; | 373 | return; |
374 | } | 374 | } |
375 | w->addrstring = strdup (api->address_to_string (api, w->addr, w->addrlen)); | 375 | w->addrstring = strdup (api->address_to_string (api, w->addr, w->addrlen)); |
376 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 376 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
377 | _("Plugin added address `%s'\n"), a2s); | 377 | "Plugin added address `%s'\n", a2s); |
378 | 378 | ||
379 | if ((GNUNET_OK != api->string_to_address (api, a2s, strlen (a2s)+1, &s2a, &s2a_len)) || (NULL == s2a)) | 379 | if ((GNUNET_OK != api->string_to_address (api, a2s, strlen (a2s)+1, &s2a, &s2a_len)) || (NULL == s2a)) |
380 | { | 380 | { |
381 | GNUNET_break (0); | 381 | GNUNET_break (0); |
382 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 382 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
383 | _("Plugin cannot convert string to address!\n")); | 383 | "Plugin cannot convert string to address!\n"); |
384 | end_badly_now(); | 384 | end_badly_now(); |
385 | return; | 385 | return; |
386 | } | 386 | } |
@@ -388,13 +388,13 @@ env_notify_address (void *cls, | |||
388 | if (s2a_len != w->addrlen) | 388 | if (s2a_len != w->addrlen) |
389 | { | 389 | { |
390 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 390 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
391 | _("Plugin creates different address length when converting address->string->address: %u != %u\n"), w->addrlen, s2a_len); | 391 | "Plugin creates different address length when converting address->string->address: %u != %u\n", w->addrlen, s2a_len); |
392 | } | 392 | } |
393 | else | 393 | else |
394 | { | 394 | { |
395 | if (0 != memcmp (s2a, w->addr, s2a_len)) | 395 | if (0 != memcmp (s2a, w->addr, s2a_len)) |
396 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 396 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
397 | _("Plugin creates different address length when connecting back and forth!\n")); | 397 | "Plugin creates different address length when connecting back and forth!\n"); |
398 | } | 398 | } |
399 | GNUNET_free (s2a); | 399 | GNUNET_free (s2a); |
400 | GNUNET_free (a2s); | 400 | GNUNET_free (a2s); |
@@ -402,7 +402,7 @@ env_notify_address (void *cls, | |||
402 | { | 402 | { |
403 | GNUNET_break (0); | 403 | GNUNET_break (0); |
404 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 404 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
405 | _("Plugin refuses added address!\n")); | 405 | "Plugin refuses added address!\n"); |
406 | end_badly_now(); | 406 | end_badly_now(); |
407 | return; | 407 | return; |
408 | } | 408 | } |
@@ -418,7 +418,7 @@ env_notify_address (void *cls, | |||
418 | else if (GNUNET_NO == add_remove) | 418 | else if (GNUNET_NO == add_remove) |
419 | { | 419 | { |
420 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 420 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
421 | _("Removing address of length %u\n"), addrlen); | 421 | "Removing address of length %u\n", addrlen); |
422 | 422 | ||
423 | w = head; | 423 | w = head; |
424 | while (NULL != w) | 424 | while (NULL != w) |
@@ -434,7 +434,7 @@ env_notify_address (void *cls, | |||
434 | { | 434 | { |
435 | GNUNET_break (0); | 435 | GNUNET_break (0); |
436 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 436 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
437 | _("Plugin removes address never added!\n")); | 437 | "Plugin removes address never added!\n"); |
438 | end_badly_now(); | 438 | end_badly_now(); |
439 | return; | 439 | return; |
440 | } | 440 | } |
@@ -448,7 +448,7 @@ env_notify_address (void *cls, | |||
448 | { | 448 | { |
449 | GNUNET_break (0); | 449 | GNUNET_break (0); |
450 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 450 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
451 | _("Invalid operation: %u \n"), add_remove); | 451 | "Invalid operation: %u\n", add_remove); |
452 | end_badly_now (); | 452 | end_badly_now (); |
453 | return; | 453 | return; |
454 | } | 454 | } |
@@ -548,14 +548,14 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
548 | &keyfile))) | 548 | &keyfile))) |
549 | { | 549 | { |
550 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 550 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
551 | _("Transport service is lacking key configuration settings. Exiting.\n")); | 551 | "Transport service is lacking key configuration settings. Exiting.\n"); |
552 | return; | 552 | return; |
553 | } | 553 | } |
554 | 554 | ||
555 | if (NULL == (stats = GNUNET_STATISTICS_create ("transport", cfg))) | 555 | if (NULL == (stats = GNUNET_STATISTICS_create ("transport", cfg))) |
556 | { | 556 | { |
557 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 557 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
558 | _("Could not create statistics. Exiting.\n")); | 558 | "Could not create statistics. Exiting.\n"); |
559 | end_badly_now (); | 559 | end_badly_now (); |
560 | return; | 560 | return; |
561 | } | 561 | } |
@@ -563,14 +563,14 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
563 | if (GNUNET_OK != GNUNET_DISK_file_test (HOSTKEY_FILE)) | 563 | if (GNUNET_OK != GNUNET_DISK_file_test (HOSTKEY_FILE)) |
564 | { | 564 | { |
565 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 565 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
566 | _("Hostkey `%s' missing. Exiting.\n"), | 566 | "Hostkey `%s' missing. Exiting.\n", |
567 | HOSTKEY_FILE); | 567 | HOSTKEY_FILE); |
568 | } | 568 | } |
569 | 569 | ||
570 | if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (keyfile)) | 570 | if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (keyfile)) |
571 | { | 571 | { |
572 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 572 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
573 | _("Could not create a directory for hostkey `%s'. Exiting.\n"), | 573 | "Could not create a directory for hostkey `%s'. Exiting.\n", |
574 | keyfile); | 574 | keyfile); |
575 | end_badly_now (); | 575 | end_badly_now (); |
576 | return; | 576 | return; |
@@ -579,7 +579,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
579 | if (GNUNET_OK != GNUNET_DISK_file_copy (HOSTKEY_FILE, keyfile)) | 579 | if (GNUNET_OK != GNUNET_DISK_file_copy (HOSTKEY_FILE, keyfile)) |
580 | { | 580 | { |
581 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 581 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
582 | _("Could not copy hostkey `%s' to destination `%s'. Exiting.\n"), | 582 | "Could not copy hostkey `%s' to destination `%s'. Exiting.\n", |
583 | HOSTKEY_FILE, keyfile); | 583 | HOSTKEY_FILE, keyfile); |
584 | end_badly_now (); | 584 | end_badly_now (); |
585 | return; | 585 | return; |
@@ -592,7 +592,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
592 | if (NULL == my_private_key) | 592 | if (NULL == my_private_key) |
593 | { | 593 | { |
594 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 594 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
595 | _("Transport service could not access hostkey. Exiting.\n")); | 595 | "Could not access hostkey. Exiting.\n"); |
596 | end_badly_now (); | 596 | end_badly_now (); |
597 | return; | 597 | return; |
598 | } | 598 | } |
@@ -611,7 +611,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
611 | sep = strrchr(argv[0],'.'); | 611 | sep = strrchr(argv[0],'.'); |
612 | if (NULL == plugin) | 612 | if (NULL == plugin) |
613 | { | 613 | { |
614 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Not a valid test name\n")); | 614 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Not a valid test name\n"); |
615 | end_badly_now (); | 615 | end_badly_now (); |
616 | return; | 616 | return; |
617 | } | 617 | } |
@@ -635,13 +635,13 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
635 | } | 635 | } |
636 | 636 | ||
637 | /* Loading plugin */ | 637 | /* Loading plugin */ |
638 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Loading transport plugin %s\n"), plugin); | 638 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loading transport plugin %s\n", plugin); |
639 | GNUNET_asprintf (&libname, "libgnunet_plugin_transport_%s", plugin); | 639 | GNUNET_asprintf (&libname, "libgnunet_plugin_transport_%s", plugin); |
640 | api = GNUNET_PLUGIN_load (libname, &env); | 640 | api = GNUNET_PLUGIN_load (libname, &env); |
641 | if (api == NULL) | 641 | if (api == NULL) |
642 | { | 642 | { |
643 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 643 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
644 | _("Failed to load transport plugin for %s\n"), plugin); | 644 | "Failed to load transport plugin for %s\n", plugin); |
645 | end_badly_now (); | 645 | end_badly_now (); |
646 | return; | 646 | return; |
647 | } | 647 | } |