aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tests/perf_ats.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-09-18 12:02:31 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-09-18 12:02:31 +0000
commit719239c84d03b9cdaf0f608a17b0c4c9327a3e25 (patch)
tree5672228e614b2792a0e4bd3cf70d31864394318d /src/ats-tests/perf_ats.c
parentb2624f59a906e36a60e4a7831655fe298332ef7d (diff)
downloadgnunet-719239c84d03b9cdaf0f608a17b0c4c9327a3e25.tar.gz
gnunet-719239c84d03b9cdaf0f608a17b0c4c9327a3e25.zip
added transport level benchmarking support
Diffstat (limited to 'src/ats-tests/perf_ats.c')
-rw-r--r--src/ats-tests/perf_ats.c236
1 files changed, 190 insertions, 46 deletions
diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c
index a50de992f..4757a78d2 100644
--- a/src/ats-tests/perf_ats.c
+++ b/src/ats-tests/perf_ats.c
@@ -62,7 +62,12 @@ struct BenchmarkPartner
62 /** 62 /**
63 * Core transmit handles 63 * Core transmit handles
64 */ 64 */
65 void *cth; 65 struct GNUNET_CORE_TransmitHandle *cth;
66
67 /**
68 * Transport transmit handles
69 */
70 struct GNUNET_TRANSPORT_TransmitHandle *tth;
66 71
67 /** 72 /**
68 * Number of messages sent to this partner 73 * Number of messages sent to this partner
@@ -144,7 +149,7 @@ struct BenchmarkPeer
144 /** 149 /**
145 * Testbed operation to connect to core 150 * Testbed operation to connect to core
146 */ 151 */
147 struct GNUNET_TESTBED_Operation *core_op; 152 struct GNUNET_TESTBED_Operation *comm_op;
148 153
149 /** 154 /**
150 * ATS performance handle 155 * ATS performance handle
@@ -163,6 +168,11 @@ struct BenchmarkPeer
163 struct GNUNET_CORE_Handle *ch; 168 struct GNUNET_CORE_Handle *ch;
164 169
165 /** 170 /**
171 * Core handle
172 */
173 struct GNUNET_TRANSPORT_Handle *th;
174
175 /**
166 * Masters only: 176 * Masters only:
167 * Peer to set ATS preferences for 177 * Peer to set ATS preferences for
168 */ 178 */
@@ -227,7 +237,7 @@ struct BenchmarkState
227 int connected_ATS_service; 237 int connected_ATS_service;
228 238
229 /* Are we connected to CORE service of all peers: GNUNET_YES/NO */ 239 /* Are we connected to CORE service of all peers: GNUNET_YES/NO */
230 int connected_CORE_service; 240 int connected_COMM_service;
231 241
232 /* Are we connected to all peers: GNUNET_YES/NO */ 242 /* Are we connected to all peers: GNUNET_YES/NO */
233 int connected_PEERS; 243 int connected_PEERS;
@@ -254,6 +264,10 @@ static GNUNET_SCHEDULER_TaskIdentifier progress_task;
254 */ 264 */
255static int result; 265static int result;
256 266
267/**Test core (GNUNET_YES) or transport (GNUNET_NO)
268 */
269static int test_core;
270
257/** 271/**
258 * Solver string 272 * Solver string
259 */ 273 */
@@ -371,6 +385,12 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
371 GNUNET_CORE_notify_transmit_ready_cancel (mps[c_m].partners[c_op].cth); 385 GNUNET_CORE_notify_transmit_ready_cancel (mps[c_m].partners[c_op].cth);
372 mps[c_m].partners[c_op].cth = NULL; 386 mps[c_m].partners[c_op].cth = NULL;
373 } 387 }
388 if (NULL != mps[c_m].partners[c_op].tth)
389 {
390 GNUNET_TRANSPORT_notify_transmit_ready_cancel (mps[c_m].partners[c_op].tth);
391 mps[c_m].partners[c_op].tth = NULL;
392 }
393
374 394
375 if (NULL != mps[c_m].core_connect_ops[c_op].connect_op) 395 if (NULL != mps[c_m].core_connect_ops[c_op].connect_op)
376 { 396 {
@@ -389,10 +409,10 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
389 mps[c_m].ats_perf_op = NULL; 409 mps[c_m].ats_perf_op = NULL;
390 } 410 }
391 411
392 if (NULL != mps[c_m].core_op) 412 if (NULL != mps[c_m].comm_op)
393 { 413 {
394 GNUNET_TESTBED_operation_done (mps[c_m].core_op); 414 GNUNET_TESTBED_operation_done (mps[c_m].comm_op);
395 mps[c_m].core_op = NULL; 415 mps[c_m].comm_op = NULL;
396 } 416 }
397 GNUNET_free(mps[c_m].core_connect_ops); 417 GNUNET_free(mps[c_m].core_connect_ops);
398 GNUNET_free(mps[c_m].partners); 418 GNUNET_free(mps[c_m].partners);
@@ -414,6 +434,12 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
414 GNUNET_CORE_notify_transmit_ready_cancel (sps[c_s].partners[c_op].cth); 434 GNUNET_CORE_notify_transmit_ready_cancel (sps[c_s].partners[c_op].cth);
415 sps[c_s].partners[c_op].cth = NULL; 435 sps[c_s].partners[c_op].cth = NULL;
416 } 436 }
437
438 if (NULL != sps[c_s].partners[c_op].tth)
439 {
440 GNUNET_TRANSPORT_notify_transmit_ready_cancel (sps[c_s].partners[c_op].tth);
441 sps[c_s].partners[c_op].tth = NULL;
442 }
417 } 443 }
418 444
419 if (NULL != sps[c_s].ats_perf_op) 445 if (NULL != sps[c_s].ats_perf_op)
@@ -421,10 +447,10 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
421 GNUNET_TESTBED_operation_done (sps[c_s].ats_perf_op); 447 GNUNET_TESTBED_operation_done (sps[c_s].ats_perf_op);
422 sps[c_s].ats_perf_op = NULL; 448 sps[c_s].ats_perf_op = NULL;
423 } 449 }
424 if (NULL != sps[c_s].core_op) 450 if (NULL != sps[c_s].comm_op)
425 { 451 {
426 GNUNET_TESTBED_operation_done (sps[c_s].core_op); 452 GNUNET_TESTBED_operation_done (sps[c_s].comm_op);
427 sps[c_s].core_op = NULL; 453 sps[c_s].comm_op = NULL;
428 } 454 }
429 455
430 GNUNET_free(sps[c_s].partners); 456 GNUNET_free(sps[c_s].partners);
@@ -479,13 +505,17 @@ controller_event_cb (void *cls,
479} 505}
480 506
481static size_t 507static size_t
482core_send_ready (void *cls, size_t size, void *buf) 508comm_send_ready (void *cls, size_t size, void *buf)
483{ 509{
484 static char msgbuf[TEST_MESSAGE_SIZE]; 510 static char msgbuf[TEST_MESSAGE_SIZE];
485 struct BenchmarkPartner *partner = cls; 511 struct BenchmarkPartner *partner = cls;
486 struct GNUNET_MessageHeader *msg; 512 struct GNUNET_MessageHeader *msg;
487 513
488 partner->cth = NULL; 514 if (GNUNET_YES == test_core)
515 partner->cth = NULL;
516 else
517 partner->tth = NULL;
518
489 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Master [%u]: Sending PING to [%u]\n", 519 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Master [%u]: Sending PING to [%u]\n",
490 partner->me->no, partner->dest->no); 520 partner->me->no, partner->dest->no);
491 521
@@ -540,7 +570,7 @@ do_benchmark ()
540 int c_s; 570 int c_s;
541 571
542 if ((state.connected_ATS_service == GNUNET_NO) 572 if ((state.connected_ATS_service == GNUNET_NO)
543 || (state.connected_CORE_service == GNUNET_NO) 573 || (state.connected_COMM_service == GNUNET_NO)
544 || (state.connected_PEERS == GNUNET_NO) 574 || (state.connected_PEERS == GNUNET_NO)
545 || (state.connected_CORE == GNUNET_NO)) 575 || (state.connected_CORE == GNUNET_NO))
546 return; 576 return;
@@ -560,9 +590,16 @@ do_benchmark ()
560 { 590 {
561 for (c_s = 0; c_s < num_slaves; c_s++) 591 for (c_s = 0; c_s < num_slaves; c_s++)
562 { 592 {
563 mps[c_m].partners[c_s].cth = GNUNET_CORE_notify_transmit_ready ( 593 if (GNUNET_YES == test_core)
594 mps[c_m].partners[c_s].cth = GNUNET_CORE_notify_transmit_ready (
564 mps[c_m].ch, GNUNET_NO, 0, GNUNET_TIME_UNIT_MINUTES, &sps[c_s].id, 595 mps[c_m].ch, GNUNET_NO, 0, GNUNET_TIME_UNIT_MINUTES, &sps[c_s].id,
565 TEST_MESSAGE_SIZE, &core_send_ready, &mps[c_m].partners[c_s]); 596 TEST_MESSAGE_SIZE, &comm_send_ready, &mps[c_m].partners[c_s]);
597 else
598 {
599 mps[c_m].partners[c_s].tth = GNUNET_TRANSPORT_notify_transmit_ready (
600 mps[c_m].th, &sps[c_s].id, TEST_MESSAGE_SIZE, 0,GNUNET_TIME_UNIT_MINUTES,
601 &comm_send_ready, &mps[c_m].partners[c_s]);
602 }
566 } 603 }
567 if (pref_val != GNUNET_ATS_PREFERENCE_END) 604 if (pref_val != GNUNET_ATS_PREFERENCE_END)
568 mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &mps[c_m]); 605 mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &mps[c_m]);
@@ -614,7 +651,7 @@ do_connect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
614 struct BenchmarkPeer *p; 651 struct BenchmarkPeer *p;
615 652
616 if ((state.connected_ATS_service == GNUNET_NO) 653 if ((state.connected_ATS_service == GNUNET_NO)
617 || (state.connected_CORE_service == GNUNET_NO)) 654 || (state.connected_COMM_service == GNUNET_NO))
618 return; 655 return;
619 656
620 GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Connecting peers on CORE level\n")); 657 GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Connecting peers on CORE level\n"));
@@ -656,7 +693,7 @@ do_connect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
656 * @param peer peer identity this notification is about 693 * @param peer peer identity this notification is about
657 */ 694 */
658static void 695static void
659core_connect_cb (void *cls, const struct GNUNET_PeerIdentity * peer) 696comm_connect_cb (void *cls, const struct GNUNET_PeerIdentity * peer)
660{ 697{
661 struct BenchmarkPeer *me = cls; 698 struct BenchmarkPeer *me = cls;
662 struct BenchmarkPeer *remote; 699 struct BenchmarkPeer *remote;
@@ -707,7 +744,7 @@ core_connect_cb (void *cls, const struct GNUNET_PeerIdentity * peer)
707} 744}
708 745
709static void 746static void
710core_disconnect_cb (void *cls, const struct GNUNET_PeerIdentity * peer) 747comm_disconnect_cb (void *cls, const struct GNUNET_PeerIdentity * peer)
711{ 748{
712 struct BenchmarkPeer *me = cls; 749 struct BenchmarkPeer *me = cls;
713 struct BenchmarkPeer *remote; 750 struct BenchmarkPeer *remote;
@@ -736,13 +773,16 @@ core_disconnect_cb (void *cls, const struct GNUNET_PeerIdentity * peer)
736} 773}
737 774
738static size_t 775static size_t
739core_send_echo_ready (void *cls, size_t size, void *buf) 776comm_send_pong_ready (void *cls, size_t size, void *buf)
740{ 777{
741 static char msgbuf[TEST_MESSAGE_SIZE]; 778 static char msgbuf[TEST_MESSAGE_SIZE];
742 struct BenchmarkPartner *p = cls; 779 struct BenchmarkPartner *p = cls;
743 struct GNUNET_MessageHeader *msg; 780 struct GNUNET_MessageHeader *msg;
744 781
745 p->cth = NULL; 782 if (GNUNET_YES == test_core)
783 p->cth = NULL;
784 else
785 p->tth = NULL;
746 786
747 p->messages_sent++; 787 p->messages_sent++;
748 p->bytes_sent += TEST_MESSAGE_SIZE; 788 p->bytes_sent += TEST_MESSAGE_SIZE;
@@ -759,7 +799,7 @@ core_send_echo_ready (void *cls, size_t size, void *buf)
759} 799}
760 800
761static int 801static int
762core_handle_ping (void *cls, const struct GNUNET_PeerIdentity *other, 802comm_handle_ping (void *cls, const struct GNUNET_PeerIdentity *other,
763 const struct GNUNET_MessageHeader *message) 803 const struct GNUNET_MessageHeader *message)
764{ 804{
765 int c_m; 805 int c_m;
@@ -780,7 +820,6 @@ core_handle_ping (void *cls, const struct GNUNET_PeerIdentity *other,
780 GNUNET_break(0); 820 GNUNET_break(0);
781 return GNUNET_SYSERR; 821 return GNUNET_SYSERR;
782 } 822 }
783 GNUNET_assert(NULL == p->cth);
784 823
785 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 824 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
786 "Slave [%u]: Received PING from [%u], sending PONG\n", me->no, 825 "Slave [%u]: Received PING from [%u], sending PONG\n", me->no,
@@ -791,14 +830,25 @@ core_handle_ping (void *cls, const struct GNUNET_PeerIdentity *other,
791 p->me->total_messages_received++; 830 p->me->total_messages_received++;
792 p->me->total_bytes_received += TEST_MESSAGE_SIZE; 831 p->me->total_bytes_received += TEST_MESSAGE_SIZE;
793 832
794 p->cth = GNUNET_CORE_notify_transmit_ready (me->ch, GNUNET_NO, 0, 833 if (GNUNET_YES == test_core)
795 GNUNET_TIME_UNIT_MINUTES, &p->dest->id, TEST_MESSAGE_SIZE, 834 {
796 &core_send_echo_ready, p); 835 GNUNET_assert (NULL == p->cth);
836 p->cth = GNUNET_CORE_notify_transmit_ready (me->ch, GNUNET_NO, 0,
837 GNUNET_TIME_UNIT_MINUTES, &p->dest->id, TEST_MESSAGE_SIZE,
838 &comm_send_pong_ready, p);
839 }
840 else
841 {
842 GNUNET_assert (NULL == p->tth);
843 p->tth = GNUNET_TRANSPORT_notify_transmit_ready (me->th, &p->dest->id,
844 TEST_MESSAGE_SIZE, 0, GNUNET_TIME_UNIT_MINUTES, &comm_send_pong_ready,
845 p);
846 }
797 return GNUNET_OK; 847 return GNUNET_OK;
798} 848}
799 849
800static int 850static int
801core_handle_pong (void *cls, const struct GNUNET_PeerIdentity *other, 851comm_handle_pong (void *cls, const struct GNUNET_PeerIdentity *other,
802 const struct GNUNET_MessageHeader *message) 852 const struct GNUNET_MessageHeader *message)
803{ 853{
804 int c_s; 854 int c_s;
@@ -820,7 +870,6 @@ core_handle_pong (void *cls, const struct GNUNET_PeerIdentity *other,
820 GNUNET_break(0); 870 GNUNET_break(0);
821 return GNUNET_SYSERR; 871 return GNUNET_SYSERR;
822 } 872 }
823 GNUNET_assert(NULL == p->cth);
824 873
825 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 874 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
826 "Master [%u]: Received PONG from [%u], next message\n", me->no, 875 "Master [%u]: Received PONG from [%u], next message\n", me->no,
@@ -831,9 +880,20 @@ core_handle_pong (void *cls, const struct GNUNET_PeerIdentity *other,
831 p->me->total_messages_received++; 880 p->me->total_messages_received++;
832 p->me->total_bytes_received += TEST_MESSAGE_SIZE; 881 p->me->total_bytes_received += TEST_MESSAGE_SIZE;
833 882
834 p->cth = GNUNET_CORE_notify_transmit_ready (me->ch, GNUNET_NO, 0, 883 if (GNUNET_YES == test_core)
835 GNUNET_TIME_UNIT_MINUTES, &p->dest->id, TEST_MESSAGE_SIZE, 884 {
836 &core_send_ready, p); 885 GNUNET_assert (NULL == p->cth);
886 p->cth = GNUNET_CORE_notify_transmit_ready (me->ch, GNUNET_NO, 0,
887 GNUNET_TIME_UNIT_MINUTES, &p->dest->id, TEST_MESSAGE_SIZE,
888 &comm_send_ready, p);
889 }
890 else
891 {
892 GNUNET_assert (NULL == p->tth);
893 p->tth = GNUNET_TRANSPORT_notify_transmit_ready (
894 me->th, &p->dest->id, TEST_MESSAGE_SIZE, 0,GNUNET_TIME_UNIT_MINUTES,
895 &comm_send_ready, p);
896 }
837 897
838 return GNUNET_OK; 898 return GNUNET_OK;
839} 899}
@@ -844,11 +904,11 @@ core_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
844 struct BenchmarkPeer *me = cls; 904 struct BenchmarkPeer *me = cls;
845 905
846 static const struct GNUNET_CORE_MessageHandler handlers[] = { { 906 static const struct GNUNET_CORE_MessageHandler handlers[] = { {
847 &core_handle_ping, TEST_MESSAGE_TYPE_PING, 0 }, { &core_handle_pong, 907 &comm_handle_ping, TEST_MESSAGE_TYPE_PING, 0 }, { &comm_handle_pong,
848 TEST_MESSAGE_TYPE_PONG, 0 }, { NULL, 0, 0 } }; 908 TEST_MESSAGE_TYPE_PONG, 0 }, { NULL, 0, 0 } };
849 909
850 me->ch = GNUNET_CORE_connect (cfg, me, NULL, core_connect_cb, 910 me->ch = GNUNET_CORE_connect (cfg, me, NULL, comm_connect_cb,
851 core_disconnect_cb, NULL, GNUNET_NO, NULL, GNUNET_NO, handlers); 911 comm_disconnect_cb, NULL, GNUNET_NO, NULL, GNUNET_NO, handlers);
852 if (NULL == me->ch) 912 if (NULL == me->ch)
853 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to create core connection \n"); 913 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to create core connection \n");
854 return me->ch; 914 return me->ch;
@@ -864,10 +924,10 @@ core_disconnect_adapter (void *cls, void *op_result)
864} 924}
865 925
866static void 926static void
867core_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op, 927comm_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
868 void *ca_result, const char *emsg) 928 void *ca_result, const char *emsg)
869{ 929{
870 static int core_done = 0; 930 static int comm_done = 0;
871 if ((NULL != emsg) || (NULL == ca_result)) 931 if ((NULL != emsg) || (NULL == ca_result))
872 { 932 {
873 GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Initialization failed, shutdown\n")); 933 GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Initialization failed, shutdown\n"));
@@ -877,34 +937,92 @@ core_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
877 shutdown_task = GNUNET_SCHEDULER_add_now (do_shutdown, NULL ); 937 shutdown_task = GNUNET_SCHEDULER_add_now (do_shutdown, NULL );
878 return; 938 return;
879 } 939 }
880 core_done++; 940 comm_done++;
881 941
882 if (core_done == num_slaves + num_masters) 942 if (comm_done == num_slaves + num_masters)
883 { 943 {
884 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Connected to all CORE services\n"); 944 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Connected to all %s services\n",
885 state.connected_CORE_service = GNUNET_YES; 945 (GNUNET_YES == test_core) ? "CORE" : "TRANSPORT");
946 state.connected_COMM_service = GNUNET_YES;
886 GNUNET_SCHEDULER_add_now (&do_connect_peers, NULL ); 947 GNUNET_SCHEDULER_add_now (&do_connect_peers, NULL );
887 } 948 }
888} 949}
889 950
890static void 951static void
891do_connect_core (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 952transport_recv_cb (void *cls,
953 const struct GNUNET_PeerIdentity * peer,
954 const struct GNUNET_MessageHeader * message)
955{
956 struct BenchmarkPeer *me = cls;
957
958 if (TEST_MESSAGE_SIZE != ntohs (message->size) ||
959 (TEST_MESSAGE_TYPE_PING != ntohs (message->type) &&
960 TEST_MESSAGE_TYPE_PONG != ntohs (message->type)))
961 {
962 return;
963 }
964 if (TEST_MESSAGE_TYPE_PING == ntohs (message->type))
965 comm_handle_ping (cls, peer, message);
966
967 if (TEST_MESSAGE_TYPE_PONG == ntohs (message->type))
968 comm_handle_pong (cls, peer, message);
969}
970
971
972static void *
973transport_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
974{
975 struct BenchmarkPeer *me = cls;
976
977 me->th = GNUNET_TRANSPORT_connect (cfg, &me->id, me, &transport_recv_cb,
978 &comm_connect_cb, &comm_disconnect_cb);
979 if (NULL == me->th)
980 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to create transport connection \n");
981 return me->th;
982}
983
984static void
985transport_disconnect_adapter (void *cls, void *op_result)
986{
987 struct BenchmarkPeer *me = cls;
988
989 GNUNET_TRANSPORT_disconnect (me->th);
990 me->th = NULL;
991}
992
993static void
994do_comm_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
892{ 995{
893 int c_s; 996 int c_s;
894 int c_m; 997 int c_m;
895 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Connecting to all CORE services\n"); 998 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Connecting to all %s services\n",
999 (GNUNET_YES == test_core) ? "CORE" : "TRANSPORT");
896 for (c_m = 0; c_m < num_masters; c_m++) 1000 for (c_m = 0; c_m < num_masters; c_m++)
897 { 1001 {
898 mps[c_m].core_op = GNUNET_TESTBED_service_connect (NULL, mps[c_m].peer, 1002 if (GNUNET_YES == test_core)
899 "core", core_connect_completion_cb, NULL, &core_connect_adapter, 1003 mps[c_m].comm_op = GNUNET_TESTBED_service_connect (NULL, mps[c_m].peer,
1004 "core", &comm_connect_completion_cb, NULL, &core_connect_adapter,
900 &core_disconnect_adapter, &mps[c_m]); 1005 &core_disconnect_adapter, &mps[c_m]);
1006 else
1007 {
1008 mps[c_m].comm_op = GNUNET_TESTBED_service_connect (NULL, mps[c_m].peer,
1009 "transport", &comm_connect_completion_cb, NULL, &transport_connect_adapter,
1010 &transport_disconnect_adapter, &mps[c_m]);
1011 }
901 } 1012 }
902 1013
903 for (c_s = 0; c_s < num_slaves; c_s++) 1014 for (c_s = 0; c_s < num_slaves; c_s++)
904 { 1015 {
905 sps[c_s].core_op = GNUNET_TESTBED_service_connect (NULL, sps[c_s].peer, 1016 if (GNUNET_YES == test_core)
906 "core", core_connect_completion_cb, NULL, &core_connect_adapter, 1017 sps[c_s].comm_op = GNUNET_TESTBED_service_connect (NULL, sps[c_s].peer,
1018 "core", &comm_connect_completion_cb, NULL, &core_connect_adapter,
907 &core_disconnect_adapter, &sps[c_s]); 1019 &core_disconnect_adapter, &sps[c_s]);
1020 else
1021 {
1022 sps[c_s].comm_op = GNUNET_TESTBED_service_connect (NULL, sps[c_s].peer,
1023 "transport", &comm_connect_completion_cb, NULL, &transport_connect_adapter,
1024 &transport_disconnect_adapter, &sps[c_s]);
1025 }
908 } 1026 }
909} 1027}
910 1028
@@ -987,7 +1105,7 @@ ats_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
987 { 1105 {
988 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Connected to all ATS services\n"); 1106 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Connected to all ATS services\n");
989 state.connected_ATS_service = GNUNET_YES; 1107 state.connected_ATS_service = GNUNET_YES;
990 GNUNET_SCHEDULER_add_now (&do_connect_core, NULL ); 1108 GNUNET_SCHEDULER_add_now (&do_comm_connect, NULL );
991 } 1109 }
992} 1110}
993 1111
@@ -1119,6 +1237,7 @@ main (int argc, char *argv[])
1119 char *tmp_sep; 1237 char *tmp_sep;
1120 char *test_name; 1238 char *test_name;
1121 char *conf_name; 1239 char *conf_name;
1240 char *comm_name;
1122 char *dotexe; 1241 char *dotexe;
1123 char *prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceTypeString; 1242 char *prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceTypeString;
1124 int c; 1243 int c;
@@ -1144,6 +1263,28 @@ main (int argc, char *argv[])
1144 return GNUNET_SYSERR; 1263 return GNUNET_SYSERR;
1145 } 1264 }
1146 tmp_sep[0] = '\0'; 1265 tmp_sep[0] = '\0';
1266 comm_name = GNUNET_strdup (&tmp_sep[1]);
1267 tmp_sep = strchr (comm_name, '_');
1268 if (NULL == tmp_sep)
1269 {
1270 fprintf (stderr, "Unable to parse test name `%s'\n", argv[0]);
1271 GNUNET_free(solver);
1272 return GNUNET_SYSERR;
1273 }
1274 tmp_sep[0] = '\0';
1275 for (c = 0; c <= strlen (comm_name); c++)
1276 comm_name[c] = toupper (comm_name[c]);
1277 if (0 == strcmp (comm_name, "CORE"))
1278 test_core = GNUNET_YES;
1279 else if (0 == strcmp (comm_name, "TRANSPORT"))
1280 test_core = GNUNET_NO;
1281 else
1282 {
1283 GNUNET_free (comm_name);
1284 GNUNET_free (solver);
1285 return GNUNET_SYSERR;
1286 }
1287
1147 pref_str = GNUNET_strdup(tmp_sep + 1); 1288 pref_str = GNUNET_strdup(tmp_sep + 1);
1148 1289
1149 GNUNET_asprintf (&conf_name, "%s%s_%s.conf", TESTNAME_PREFIX, solver, 1290 GNUNET_asprintf (&conf_name, "%s%s_%s.conf", TESTNAME_PREFIX, solver,
@@ -1175,6 +1316,7 @@ main (int argc, char *argv[])
1175 fprintf (stderr, "Unknown preference: `%s'\n", pref_str); 1316 fprintf (stderr, "Unknown preference: `%s'\n", pref_str);
1176 GNUNET_free(solver); 1317 GNUNET_free(solver);
1177 GNUNET_free(pref_str); 1318 GNUNET_free(pref_str);
1319 GNUNET_free (comm_name);
1178 return -1; 1320 return -1;
1179 } 1321 }
1180 1322
@@ -1216,11 +1358,12 @@ main (int argc, char *argv[])
1216 GNUNET_free(test_name); 1358 GNUNET_free(test_name);
1217 GNUNET_free(solver); 1359 GNUNET_free(solver);
1218 GNUNET_free(pref_str); 1360 GNUNET_free(pref_str);
1361 GNUNET_free (comm_name);
1219 return GNUNET_SYSERR; 1362 return GNUNET_SYSERR;
1220 } 1363 }
1221 1364
1222 state.connected_ATS_service = GNUNET_NO; 1365 state.connected_ATS_service = GNUNET_NO;
1223 state.connected_CORE_service = GNUNET_NO; 1366 state.connected_COMM_service = GNUNET_NO;
1224 state.connected_PEERS = GNUNET_NO; 1367 state.connected_PEERS = GNUNET_NO;
1225 state.benchmarking = GNUNET_NO; 1368 state.benchmarking = GNUNET_NO;
1226 state.connected_PEERS = GNUNET_NO; 1369 state.connected_PEERS = GNUNET_NO;
@@ -1241,6 +1384,7 @@ main (int argc, char *argv[])
1241 GNUNET_free(pref_str); 1384 GNUNET_free(pref_str);
1242 GNUNET_free(conf_name); 1385 GNUNET_free(conf_name);
1243 GNUNET_free(test_name); 1386 GNUNET_free(test_name);
1387 GNUNET_free (comm_name);
1244 GNUNET_free(mps); 1388 GNUNET_free(mps);
1245 GNUNET_free(sps); 1389 GNUNET_free(sps);
1246 1390