aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r--src/transport/gnunet-transport.c367
1 files changed, 179 insertions, 188 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index b8d3c84b9..eec52cdce 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2011-2014 GNUnet e.V. 3 Copyright (C) 2011-2014, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -32,6 +32,7 @@
32#include "gnunet_resolver_service.h" 32#include "gnunet_resolver_service.h"
33#include "gnunet_protocols.h" 33#include "gnunet_protocols.h"
34#include "gnunet_transport_service.h" 34#include "gnunet_transport_service.h"
35#include "gnunet_transport_core_service.h"
35#include "gnunet_nat_lib.h" 36#include "gnunet_nat_lib.h"
36 37
37/** 38/**
@@ -258,7 +259,7 @@ static char *cpid;
258/** 259/**
259 * Handle to transport service. 260 * Handle to transport service.
260 */ 261 */
261static struct GNUNET_TRANSPORT_Handle *handle; 262static struct GNUNET_TRANSPORT_CoreHandle *handle;
262 263
263/** 264/**
264 * Configuration handle 265 * Configuration handle
@@ -351,11 +352,6 @@ static unsigned long long traffic_sent;
351static struct GNUNET_TIME_Absolute start_time; 352static struct GNUNET_TIME_Absolute start_time;
352 353
353/** 354/**
354 * Handle for current transmission request.
355 */
356static struct GNUNET_TRANSPORT_TransmitHandle *th;
357
358/**
359 * Map storing information about monitored peers 355 * Map storing information about monitored peers
360 */ 356 */
361static struct GNUNET_CONTAINER_MultiPeerMap *monitored_peers; 357static struct GNUNET_CONTAINER_MultiPeerMap *monitored_peers;
@@ -382,14 +378,9 @@ static struct GNUNET_TRANSPORT_PluginMonitor *pm;
382static struct GNUNET_PeerIdentity pid; 378static struct GNUNET_PeerIdentity pid;
383 379
384/** 380/**
385 * Task scheduled for cleanup / termination of the process.
386 */
387static struct GNUNET_SCHEDULER_Task * end;
388
389/**
390 * Task for operation timeout 381 * Task for operation timeout
391 */ 382 */
392static struct GNUNET_SCHEDULER_Task * op_timeout; 383static struct GNUNET_SCHEDULER_Task *op_timeout;
393 384
394/** 385/**
395 * Selected level of verbosity. 386 * Selected level of verbosity.
@@ -409,12 +400,12 @@ static unsigned int address_resolutions;
409/** 400/**
410 * DLL for NAT Test Contexts: head 401 * DLL for NAT Test Contexts: head
411 */ 402 */
412struct TestContext *head; 403static struct TestContext *head;
413 404
414/** 405/**
415 * DLL for NAT Test Contexts: tail 406 * DLL for NAT Test Contexts: tail
416 */ 407 */
417struct TestContext *tail; 408static struct TestContext *tail;
418 409
419/** 410/**
420 * DLL: head of validation resolution entries 411 * DLL: head of validation resolution entries
@@ -476,7 +467,6 @@ shutdown_task (void *cls)
476 struct ValidationResolutionContext *next; 467 struct ValidationResolutionContext *next;
477 struct PeerResolutionContext *rc; 468 struct PeerResolutionContext *rc;
478 469
479 end = NULL;
480 if (NULL != op_timeout) 470 if (NULL != op_timeout)
481 { 471 {
482 GNUNET_SCHEDULER_cancel (op_timeout); 472 GNUNET_SCHEDULER_cancel (op_timeout);
@@ -516,14 +506,9 @@ shutdown_task (void *cls)
516 GNUNET_free (rc->addrcp); 506 GNUNET_free (rc->addrcp);
517 GNUNET_free (rc); 507 GNUNET_free (rc);
518 } 508 }
519 if (NULL != th)
520 {
521 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
522 th = NULL;
523 }
524 if (NULL != handle) 509 if (NULL != handle)
525 { 510 {
526 GNUNET_TRANSPORT_disconnect (handle); 511 GNUNET_TRANSPORT_core_disconnect (handle);
527 handle = NULL; 512 handle = NULL;
528 } 513 }
529 if (benchmark_send) 514 if (benchmark_send)
@@ -533,7 +518,8 @@ shutdown_task (void *cls)
533 _("Transmitted %llu bytes/s (%llu bytes in %s)\n"), 518 _("Transmitted %llu bytes/s (%llu bytes in %s)\n"),
534 1000LL * 1000LL * traffic_sent / (1 + duration.rel_value_us), 519 1000LL * 1000LL * traffic_sent / (1 + duration.rel_value_us),
535 traffic_sent, 520 traffic_sent,
536 GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES)); 521 GNUNET_STRINGS_relative_time_to_string (duration,
522 GNUNET_YES));
537 } 523 }
538 if (benchmark_receive) 524 if (benchmark_receive)
539 { 525 {
@@ -542,12 +528,15 @@ shutdown_task (void *cls)
542 _("Received %llu bytes/s (%llu bytes in %s)\n"), 528 _("Received %llu bytes/s (%llu bytes in %s)\n"),
543 1000LL * 1000LL * traffic_received / (1 + duration.rel_value_us), 529 1000LL * 1000LL * traffic_received / (1 + duration.rel_value_us),
544 traffic_received, 530 traffic_received,
545 GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES)); 531 GNUNET_STRINGS_relative_time_to_string (duration,
532 GNUNET_YES));
546 } 533 }
547 534
548 if (NULL != monitored_peers) 535 if (NULL != monitored_peers)
549 { 536 {
550 GNUNET_CONTAINER_multipeermap_iterate (monitored_peers, &destroy_it, NULL); 537 GNUNET_CONTAINER_multipeermap_iterate (monitored_peers,
538 &destroy_it,
539 NULL);
551 GNUNET_CONTAINER_multipeermap_destroy (monitored_peers); 540 GNUNET_CONTAINER_multipeermap_destroy (monitored_peers);
552 monitored_peers = NULL; 541 monitored_peers = NULL;
553 } 542 }
@@ -795,42 +784,33 @@ do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg)
795 784
796/** 785/**
797 * Function called to notify a client about the socket 786 * Function called to notify a client about the socket
798 * begin ready to queue more data. @a buf will be 787 * begin ready to queue more data. Sends another message.
799 * NULL and @a size zero if the socket was closed for
800 * writing in the meantime.
801 * 788 *
802 * @param cls closure 789 * @param cls closure with the message queue
803 * @param size number of bytes available in @a buf 790 */
804 * @param buf where the callee should write the message 791static void
805 * @return number of bytes written to @a buf 792do_send (void *cls)
806 */
807static size_t
808transmit_data (void *cls,
809 size_t size,
810 void *buf)
811{ 793{
812 struct GNUNET_MessageHeader *m = buf; 794 struct GNUNET_MQ_Handle *mq = cls;
813 795 struct GNUNET_MessageHeader *m;
814 if ((NULL == buf) || (0 == size)) 796 struct GNUNET_MQ_Envelope *env;
815 { 797
816 th = NULL; 798 env = GNUNET_MQ_msg_extra (m,
817 return 0; 799 BLOCKSIZE * 1024,
818 } 800 GNUNET_MESSAGE_TYPE_DUMMY);
819 801 memset (&m[1],
820 GNUNET_assert(size >= sizeof(struct GNUNET_MessageHeader)); 802 52,
821 GNUNET_assert(size < GNUNET_SERVER_MAX_MESSAGE_SIZE); 803 BLOCKSIZE * 1024 - sizeof(struct GNUNET_MessageHeader));
822 m->size = ntohs (size); 804 traffic_sent += BLOCKSIZE * 1024;
823 m->type = ntohs (GNUNET_MESSAGE_TYPE_DUMMY); 805 GNUNET_MQ_notify_sent (env,
824 memset (&m[1], 52, size - sizeof(struct GNUNET_MessageHeader)); 806 &do_send,
825 traffic_sent += size; 807 mq);
826 th = GNUNET_TRANSPORT_notify_transmit_ready (handle, &pid,
827 BLOCKSIZE * 1024,
828 GNUNET_TIME_UNIT_FOREVER_REL,
829 &transmit_data, NULL);
830 if (verbosity > 0) 808 if (verbosity > 0)
831 FPRINTF (stdout, _("Transmitting %u bytes to %s\n"), (unsigned int) size, 809 FPRINTF (stdout,
832 GNUNET_i2s (&pid)); 810 _("Transmitting %u bytes\n"),
833 return size; 811 (unsigned int) BLOCKSIZE * 1024);
812 GNUNET_MQ_send (mq,
813 env);
834} 814}
835 815
836 816
@@ -840,36 +820,33 @@ transmit_data (void *cls,
840 * 820 *
841 * @param cls closure 821 * @param cls closure
842 * @param peer the peer that connected 822 * @param peer the peer that connected
823 * @param mq message queue for sending to @a peer
843 */ 824 */
844static void 825static void *
845notify_connect (void *cls, 826notify_connect (void *cls,
846 const struct GNUNET_PeerIdentity *peer) 827 const struct GNUNET_PeerIdentity *peer,
828 struct GNUNET_MQ_Handle *mq)
847{ 829{
848 if (0 != memcmp (&pid, peer, sizeof(struct GNUNET_PeerIdentity))) 830 if (0 != memcmp (&pid,
849 return; 831 peer,
832 sizeof(struct GNUNET_PeerIdentity)))
833 return NULL;
850 ret = 0; 834 ret = 0;
851 if (benchmark_send) 835 if (! benchmark_send)
836 return NULL;
837 if (NULL != op_timeout)
852 { 838 {
853 if (NULL != op_timeout) 839 GNUNET_SCHEDULER_cancel (op_timeout);
854 { 840 op_timeout = NULL;
855 GNUNET_SCHEDULER_cancel (op_timeout);
856 op_timeout = NULL;
857 }
858 if (verbosity > 0)
859 FPRINTF (stdout,
860 _("Successfully connected to `%s', starting to send benchmark data in %u Kb blocks\n"),
861 GNUNET_i2s (&pid), BLOCKSIZE);
862 start_time = GNUNET_TIME_absolute_get ();
863 if (NULL == th)
864 th = GNUNET_TRANSPORT_notify_transmit_ready (handle, peer,
865 BLOCKSIZE * 1024,
866 GNUNET_TIME_UNIT_FOREVER_REL,
867 &transmit_data,
868 NULL);
869 else
870 GNUNET_break(0);
871 return;
872 } 841 }
842 if (verbosity > 0)
843 FPRINTF (stdout,
844 _("Successfully connected to `%s', starting to send benchmark data in %u Kb blocks\n"),
845 GNUNET_i2s (peer),
846 BLOCKSIZE);
847 start_time = GNUNET_TIME_absolute_get ();
848 do_send (mq);
849 return mq;
873} 850}
874 851
875 852
@@ -879,27 +856,24 @@ notify_connect (void *cls,
879 * 856 *
880 * @param cls closure 857 * @param cls closure
881 * @param peer the peer that disconnected 858 * @param peer the peer that disconnected
859 * @param internal_cls what we returned from #notify_connect()
882 */ 860 */
883static void 861static void
884notify_disconnect (void *cls, 862notify_disconnect (void *cls,
885 const struct GNUNET_PeerIdentity *peer) 863 const struct GNUNET_PeerIdentity *peer,
864 void *internal_cls)
886{ 865{
887 if (0 != memcmp (&pid, peer, sizeof(struct GNUNET_PeerIdentity))) 866 if (0 != memcmp (&pid,
867 peer,
868 sizeof(struct GNUNET_PeerIdentity)))
888 return; 869 return;
889 870 if (NULL == internal_cls)
890 if (NULL != th) 871 return; /* not about target peer */
891 { 872 if (! benchmark_send)
892 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); 873 return; /* not transmitting */
893 th = NULL; 874 FPRINTF (stdout,
894 } 875 _("Disconnected from peer `%s' while benchmarking\n"),
895 if (benchmark_send) 876 GNUNET_i2s (&pid));
896 {
897 FPRINTF (stdout, _("Disconnected from peer `%s' while benchmarking\n"),
898 GNUNET_i2s (&pid));
899 if (NULL != end)
900 GNUNET_SCHEDULER_cancel (end);
901 return;
902 }
903} 877}
904 878
905 879
@@ -909,21 +883,25 @@ notify_disconnect (void *cls,
909 * 883 *
910 * @param cls closure 884 * @param cls closure
911 * @param peer the peer that connected 885 * @param peer the peer that connected
886 * @param mq for sending messages to @a peer
887 * @return NULL
912 */ 888 */
913static void 889static void *
914monitor_notify_connect (void *cls, 890monitor_notify_connect (void *cls,
915 const struct GNUNET_PeerIdentity *peer) 891 const struct GNUNET_PeerIdentity *peer,
892 struct GNUNET_MQ_Handle *mq)
916{ 893{
917 monitor_connect_counter++;
918 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); 894 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
919 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now); 895 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now);
920 896
897 monitor_connect_counter++;
921 FPRINTF (stdout, 898 FPRINTF (stdout,
922 _("%24s: %-17s %4s (%u connections in total)\n"), 899 _("%24s: %-17s %4s (%u connections in total)\n"),
923 now_str, 900 now_str,
924 _("Connected to"), 901 _("Connected to"),
925 GNUNET_i2s (peer), 902 GNUNET_i2s (peer),
926 monitor_connect_counter); 903 monitor_connect_counter);
904 return NULL;
927} 905}
928 906
929 907
@@ -933,10 +911,12 @@ monitor_notify_connect (void *cls,
933 * 911 *
934 * @param cls closure 912 * @param cls closure
935 * @param peer the peer that disconnected 913 * @param peer the peer that disconnected
914 * @param internal_cls what we returned from #monitor_notify_connect()
936 */ 915 */
937static void 916static void
938monitor_notify_disconnect (void *cls, 917monitor_notify_disconnect (void *cls,
939 const struct GNUNET_PeerIdentity *peer) 918 const struct GNUNET_PeerIdentity *peer,
919 void *internal_cls)
940{ 920{
941 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); 921 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
942 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now); 922 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now);
@@ -957,29 +937,35 @@ monitor_notify_disconnect (void *cls,
957 * Function called by the transport for each received message. 937 * Function called by the transport for each received message.
958 * 938 *
959 * @param cls closure 939 * @param cls closure
960 * @param peer (claimed) identity of the other peer
961 * @param message the message 940 * @param message the message
962 */ 941 */
963static void 942static int
964notify_receive (void *cls, 943check_dummy (void *cls,
965 const struct GNUNET_PeerIdentity *peer, 944 const struct GNUNET_MessageHeader *message)
966 const struct GNUNET_MessageHeader *message)
967{ 945{
968 if (benchmark_receive) 946 return GNUNET_OK; /* all messages are fine */
969 { 947}
970 if (GNUNET_MESSAGE_TYPE_DUMMY != ntohs (message->type)) 948
971 return;
972 if (verbosity > 0)
973 FPRINTF (stdout,
974 _("Received %u bytes from %s\n"),
975 (unsigned int) ntohs (message->size),
976 GNUNET_i2s (peer));
977 949
978 if (traffic_received == 0) 950/**
979 start_time = GNUNET_TIME_absolute_get (); 951 * Function called by the transport for each received message.
980 traffic_received += ntohs (message->size); 952 *
953 * @param cls closure
954 * @param message the message
955 */
956static void
957handle_dummy (void *cls,
958 const struct GNUNET_MessageHeader *message)
959{
960 if (! benchmark_receive)
981 return; 961 return;
982 } 962 if (verbosity > 0)
963 FPRINTF (stdout,
964 _("Received %u bytes\n"),
965 (unsigned int) ntohs (message->size));
966 if (0 == traffic_received)
967 start_time = GNUNET_TIME_absolute_get ();
968 traffic_received += ntohs (message->size);
983} 969}
984 970
985 971
@@ -1007,7 +993,8 @@ print_info (const struct GNUNET_PeerIdentity *id,
1007 struct GNUNET_TIME_Absolute state_timeout) 993 struct GNUNET_TIME_Absolute state_timeout)
1008{ 994{
1009 995
1010 if ( ((GNUNET_YES == iterate_connections) && (GNUNET_YES == iterate_all)) || 996 if ( ((GNUNET_YES == iterate_connections) &&
997 (GNUNET_YES == iterate_all)) ||
1011 (GNUNET_YES == monitor_connections)) 998 (GNUNET_YES == monitor_connections))
1012 { 999 {
1013 FPRINTF (stdout, 1000 FPRINTF (stdout,
@@ -1019,7 +1006,7 @@ print_info (const struct GNUNET_PeerIdentity *id,
1019 GNUNET_STRINGS_absolute_time_to_string (state_timeout)); 1006 GNUNET_STRINGS_absolute_time_to_string (state_timeout));
1020 } 1007 }
1021 else if ( (GNUNET_YES == iterate_connections) && 1008 else if ( (GNUNET_YES == iterate_connections) &&
1022 (GNUNET_TRANSPORT_is_connected(state))) 1009 (GNUNET_TRANSPORT_is_connected(state)) )
1023 { 1010 {
1024 /* Only connected peers, skip state */ 1011 /* Only connected peers, skip state */
1025 FPRINTF (stdout, 1012 FPRINTF (stdout,
@@ -1161,7 +1148,8 @@ resolve_peer_address (const struct GNUNET_HELLO_Address *address,
1161 address, 1148 address,
1162 numeric, 1149 numeric,
1163 RESOLUTION_TIMEOUT, 1150 RESOLUTION_TIMEOUT,
1164 &process_peer_string, rc); 1151 &process_peer_string,
1152 rc);
1165} 1153}
1166 1154
1167 1155
@@ -1515,25 +1503,31 @@ blacklist_cb (void *cls,
1515 1503
1516 1504
1517/** 1505/**
1518 * Function called with the result of the check if the 'transport' 1506 * Main function that will be run by the scheduler.
1519 * service is running.
1520 * 1507 *
1521 * @param cls closure with our configuration 1508 * @param cls closure
1522 * @param result #GNUNET_YES if transport is running 1509 * @param args remaining command-line arguments
1510 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
1511 * @param mycfg configuration
1523 */ 1512 */
1524static void 1513static void
1525testservice_task (void *cls, 1514run (void *cls,
1526 int result) 1515 char * const *args,
1516 const char *cfgfile,
1517 const struct GNUNET_CONFIGURATION_Handle *mycfg)
1527{ 1518{
1519 GNUNET_MQ_hd_var_size (dummy,
1520 GNUNET_MESSAGE_TYPE_DUMMY,
1521 struct GNUNET_MessageHeader);
1528 int counter = 0; 1522 int counter = 0;
1529 ret = 1; 1523 ret = 1;
1530 1524
1531 if (GNUNET_YES != result) 1525 cfg = (struct GNUNET_CONFIGURATION_Handle *) mycfg;
1526 if (test_configuration)
1532 { 1527 {
1533 FPRINTF (stderr, _("Service `%s' is not running\n"), "transport"); 1528 do_test_configuration (cfg);
1534 return; 1529 return;
1535 } 1530 }
1536
1537 if ( (NULL != cpid) && 1531 if ( (NULL != cpid) &&
1538 (GNUNET_OK != 1532 (GNUNET_OK !=
1539 GNUNET_CRYPTO_eddsa_public_key_from_string (cpid, 1533 GNUNET_CRYPTO_eddsa_public_key_from_string (cpid,
@@ -1554,16 +1548,26 @@ testservice_task (void *cls,
1554 { 1548 {
1555 FPRINTF (stderr, 1549 FPRINTF (stderr,
1556 _("Multiple operations given. Please choose only one operation: %s, %s, %s, %s, %s, %s %s\n"), 1550 _("Multiple operations given. Please choose only one operation: %s, %s, %s, %s, %s, %s %s\n"),
1557 "disconnect", "benchmark send", "benchmark receive", "information", 1551 "disconnect",
1558 "monitor", "events", "plugins"); 1552 "benchmark send",
1553 "benchmark receive",
1554 "information",
1555 "monitor",
1556 "events",
1557 "plugins");
1559 return; 1558 return;
1560 } 1559 }
1561 if (0 == counter) 1560 if (0 == counter)
1562 { 1561 {
1563 FPRINTF (stderr, 1562 FPRINTF (stderr,
1564 _("No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n"), 1563 _("No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n"),
1565 "disconnect", "benchmark send", "benchmark receive", "information", 1564 "disconnect",
1566 "monitor", "events", "plugins"); 1565 "benchmark send",
1566 "benchmark receive",
1567 "information",
1568 "monitor",
1569 "events",
1570 "plugins");
1567 return; 1571 return;
1568 } 1572 }
1569 1573
@@ -1596,20 +1600,24 @@ testservice_task (void *cls,
1596 { 1600 {
1597 if (NULL == cpid) 1601 if (NULL == cpid)
1598 { 1602 {
1599 FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), 1603 FPRINTF (stderr,
1600 "-s", "-p"); 1604 _("Option `%s' makes no sense without option `%s'.\n"),
1605 "-s", "-p");
1601 ret = 1; 1606 ret = 1;
1602 return; 1607 return;
1603 } 1608 }
1604 handle = GNUNET_TRANSPORT_connect (cfg, 1609 handle = GNUNET_TRANSPORT_core_connect (cfg,
1605 NULL, 1610 NULL,
1606 NULL, 1611 NULL,
1607 &notify_receive, 1612 NULL,
1608 &notify_connect, 1613 &notify_connect,
1609 &notify_disconnect); 1614 &notify_disconnect,
1615 NULL);
1610 if (NULL == handle) 1616 if (NULL == handle)
1611 { 1617 {
1612 FPRINTF (stderr, "%s", _("Failed to connect to transport service\n")); 1618 FPRINTF (stderr,
1619 "%s",
1620 _("Failed to connect to transport service\n"));
1613 ret = 1; 1621 ret = 1;
1614 return; 1622 return;
1615 } 1623 }
@@ -1620,20 +1628,30 @@ testservice_task (void *cls,
1620 } 1628 }
1621 else if (benchmark_receive) /* -b: Benchmark receiving */ 1629 else if (benchmark_receive) /* -b: Benchmark receiving */
1622 { 1630 {
1623 handle = GNUNET_TRANSPORT_connect (cfg, 1631 struct GNUNET_MQ_MessageHandler handlers[] = {
1624 NULL, 1632 make_dummy_handler (NULL),
1625 NULL, 1633 GNUNET_MQ_handler_end ()
1626 &notify_receive, 1634 };
1627 NULL, 1635
1628 NULL); 1636 handle = GNUNET_TRANSPORT_core_connect (cfg,
1637 NULL,
1638 handlers,
1639 NULL,
1640 NULL,
1641 NULL,
1642 NULL);
1629 if (NULL == handle) 1643 if (NULL == handle)
1630 { 1644 {
1631 FPRINTF (stderr, "%s", _("Failed to connect to transport service\n")); 1645 FPRINTF (stderr,
1646 "%s",
1647 _("Failed to connect to transport service\n"));
1632 ret = 1; 1648 ret = 1;
1633 return; 1649 return;
1634 } 1650 }
1635 if (verbosity > 0) 1651 if (verbosity > 0)
1636 FPRINTF (stdout, "%s", _("Starting to receive benchmark data\n")); 1652 FPRINTF (stdout,
1653 "%s",
1654 _("Starting to receive benchmark data\n"));
1637 start_time = GNUNET_TIME_absolute_get (); 1655 start_time = GNUNET_TIME_absolute_get ();
1638 1656
1639 } 1657 }
@@ -1668,12 +1686,13 @@ testservice_task (void *cls,
1668 else if (monitor_connects) /* -e : Monitor (dis)connect events continuously */ 1686 else if (monitor_connects) /* -e : Monitor (dis)connect events continuously */
1669 { 1687 {
1670 monitor_connect_counter = 0; 1688 monitor_connect_counter = 0;
1671 handle = GNUNET_TRANSPORT_connect (cfg, 1689 handle = GNUNET_TRANSPORT_core_connect (cfg,
1672 NULL, 1690 NULL,
1673 NULL, 1691 NULL,
1674 NULL, 1692 NULL,
1675 &monitor_notify_connect, 1693 &monitor_notify_connect,
1676 &monitor_notify_disconnect); 1694 &monitor_notify_disconnect,
1695 NULL);
1677 if (NULL == handle) 1696 if (NULL == handle)
1678 { 1697 {
1679 FPRINTF (stderr, 1698 FPRINTF (stderr,
@@ -1695,34 +1714,6 @@ testservice_task (void *cls,
1695} 1714}
1696 1715
1697 1716
1698/**
1699 * Main function that will be run by the scheduler.
1700 *
1701 * @param cls closure
1702 * @param args remaining command-line arguments
1703 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
1704 * @param mycfg configuration
1705 */
1706static void
1707run (void *cls,
1708 char * const *args,
1709 const char *cfgfile,
1710 const struct GNUNET_CONFIGURATION_Handle *mycfg)
1711{
1712 cfg = (struct GNUNET_CONFIGURATION_Handle *) mycfg;
1713 if (test_configuration)
1714 {
1715 do_test_configuration (cfg);
1716 return;
1717 }
1718 GNUNET_CLIENT_service_test ("transport",
1719 cfg,
1720 GNUNET_TIME_UNIT_SECONDS,
1721 &testservice_task,
1722 (void *) cfg);
1723}
1724
1725
1726int 1717int
1727main (int argc, 1718main (int argc,
1728 char * const *argv) 1719 char * const *argv)