aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-29 20:03:12 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-29 20:03:12 +0000
commit75bbeaffe2a1467b6f9f4d80bc4d87ed0d9f14a8 (patch)
tree63885d0e8e55d47ecae25cef37181597115c8980 /src/transport/gnunet-transport.c
parent56c32ea37a52b239494a7f91933e60eb7caf30f3 (diff)
downloadgnunet-75bbeaffe2a1467b6f9f4d80bc4d87ed0d9f14a8.tar.gz
gnunet-75bbeaffe2a1467b6f9f4d80bc4d87ed0d9f14a8.zip
-cleaning up message format and code related to recent transport address stringification code
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r--src/transport/gnunet-transport.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 9097311a6..66f02b104 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -444,7 +444,7 @@ void process_string (void *cls,
444 444
445 if ((address != NULL)) 445 if ((address != NULL))
446 { 446 {
447 fprintf (stdout, _("Peer `%s' : %s\n"), GNUNET_i2s(peer), address); 447 fprintf (stdout, _("Peer `%s': %s\n"), GNUNET_i2s(peer), address);
448 } 448 }
449 else 449 else
450 { 450 {
@@ -463,26 +463,29 @@ void process_string (void *cls,
463 * @param addrlen number of bytes in addr 463 * @param addrlen number of bytes in addr
464 */ 464 */
465static void 465static void
466process_address (void *cls, const struct GNUNET_HELLO_Address *address) 466process_address (void *cls,
467 const struct GNUNET_PeerIdentity *peer,
468 const struct GNUNET_HELLO_Address *address)
467{ 469{
468 const struct GNUNET_CONFIGURATION_Handle * cfg = cls; 470 const struct GNUNET_CONFIGURATION_Handle * cfg = cls;
471 struct GNUNET_PeerIdentity *peercp;
469 472
470 if (address == NULL) 473 if ( (address == NULL) || (peer == NULL) )
471 { 474 {
472 /* done */ 475 /* done */
473 return; 476 return;
474 } 477 }
475 478
476 struct GNUNET_PeerIdentity * peer = GNUNET_malloc(sizeof (struct GNUNET_PeerIdentity)); 479 peercp = GNUNET_malloc(sizeof (struct GNUNET_PeerIdentity));
477 *peer = address->peer; 480 *peercp = *peer;
478 481
479 /* Resolve address to string */ 482 /* Resolve address to string */
480 GNUNET_TRANSPORT_address_to_string (cfg, 483 GNUNET_TRANSPORT_address_to_string (cfg,
481 address, 484 address,
482 numeric, 485 numeric,
483 GNUNET_TIME_UNIT_MINUTES, 486 GNUNET_TIME_UNIT_MINUTES,
484 &process_string, 487 &process_string,
485 peer); 488 peercp);
486} 489}
487 490
488 491
@@ -538,8 +541,9 @@ run (void *cls, char *const *args, const char *cfgfile,
538 } 541 }
539 if (iterate_connections) 542 if (iterate_connections)
540 { 543 {
541 GNUNET_TRANSPORT_address_iterate (cfg, GNUNET_TIME_UNIT_MINUTES, 544 GNUNET_TRANSPORT_peer_get_active_addresses (cfg, NULL, GNUNET_YES,
542 &process_address, (void *)cfg); 545 GNUNET_TIME_UNIT_MINUTES,
546 &process_address, (void *)cfg);
543 } 547 }
544} 548}
545 549