aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/test_cadet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet/test_cadet.c')
-rw-r--r--src/cadet/test_cadet.c365
1 files changed, 324 insertions, 41 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c
index 25713709c..779d3bc9f 100644
--- a/src/cadet/test_cadet.c
+++ b/src/cadet/test_cadet.c
@@ -25,6 +25,7 @@
25 */ 25 */
26#include <stdio.h> 26#include <stdio.h>
27#include "platform.h" 27#include "platform.h"
28#include "cadet.h"
28#include "cadet_test_lib.h" 29#include "cadet_test_lib.h"
29#include "gnunet_cadet_service.h" 30#include "gnunet_cadet_service.h"
30#include "gnunet_statistics_service.h" 31#include "gnunet_statistics_service.h"
@@ -74,6 +75,17 @@ struct CadetTestChannelWrapper
74#define SPEED_REL 8 75#define SPEED_REL 8
75#define P2P_SIGNAL 10 76#define P2P_SIGNAL 10
76#define REOPEN 11 77#define REOPEN 11
78#define DESTROY 12
79
80/**
81 * Active peer listing operation.
82 */
83static struct GNUNET_CADET_PeersLister *plo;
84
85/*
86 * Task called to check for existing tunnel and depending on that reopen channel
87 */
88static struct GNUNET_SCHEDULER_Task *get_peers_task;
77 89
78/** 90/**
79 * Which test are we running? 91 * Which test are we running?
@@ -123,7 +135,12 @@ static struct GNUNET_TESTBED_Operation *t_op[2];
123/** 135/**
124 * Peer ids. 136 * Peer ids.
125 */ 137 */
126static struct GNUNET_PeerIdentity *p_id[2]; 138static struct GNUNET_PeerIdentity *testpeer_id[2];
139
140/**
141 * Peer ids.
142 */
143static struct GNUNET_CONFIGURATION_Handle *p_cfg[2];
127 144
128/** 145/**
129 * Port ID 146 * Port ID
@@ -133,7 +150,7 @@ static struct GNUNET_HashCode port;
133/** 150/**
134 * Peer ids counter. 151 * Peer ids counter.
135 */ 152 */
136static unsigned int p_ids; 153static unsigned int peerinfo_task_cnt;
137 154
138/** 155/**
139 * Is the setup initialized? 156 * Is the setup initialized?
@@ -196,16 +213,6 @@ static struct GNUNET_SCHEDULER_Task *test_task;
196static struct GNUNET_SCHEDULER_Task *send_next_msg_task; 213static struct GNUNET_SCHEDULER_Task *send_next_msg_task;
197 214
198/** 215/**
199 * Cadet handle for the root peer
200 */
201static struct GNUNET_CADET_Handle *h1;
202
203/**
204 * Cadet handle for the first leaf peer
205 */
206static struct GNUNET_CADET_Handle *h2;
207
208/**
209 * Channel handle for the root peer 216 * Channel handle for the root peer
210 */ 217 */
211static struct GNUNET_CADET_Channel *outgoing_ch; 218static struct GNUNET_CADET_Channel *outgoing_ch;
@@ -226,6 +233,9 @@ static struct GNUNET_TIME_Absolute start_time;
226 */ 233 */
227static struct GNUNET_TESTBED_Peer **testbed_peers; 234static struct GNUNET_TESTBED_Peer **testbed_peers;
228 235
236
237struct GNUNET_CADET_Handle **cadets_running;
238
229/** 239/**
230 * Statistics operation handle. 240 * Statistics operation handle.
231 */ 241 */
@@ -246,6 +256,17 @@ static unsigned int ka_received;
246 */ 256 */
247static unsigned int msg_dropped; 257static unsigned int msg_dropped;
248 258
259/**
260 * Drop the next cadet message of a given type..
261 *
262 * @param mq message queue
263 * @param ccn client channel number.
264 * @param type of cadet message to be dropped.
265 */
266void
267GNUNET_CADET_drop_message (struct GNUNET_MQ_Handle *mq,
268 struct GNUNET_CADET_ClientChannelNumber ccn,
269 uint16_t type);
249 270
250/******************************************************************************/ 271/******************************************************************************/
251 272
@@ -516,6 +537,49 @@ static void
516disconnect_handler (void *cls, 537disconnect_handler (void *cls,
517 const struct GNUNET_CADET_Channel *channel); 538 const struct GNUNET_CADET_Channel *channel);
518 539
540static struct GNUNET_PeerIdentity *
541get_from_p_ids ()
542{
543 if (0 < GNUNET_memcmp (testpeer_id[0], testpeer_id[1]))
544 {
545 return testpeer_id[1];
546 }
547 else
548 {
549 return testpeer_id[0];
550 }
551}
552
553static struct GNUNET_CADET_Handle *
554get_from_cadets ()
555{
556
557 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "1\n");
558 if (0 < GNUNET_memcmp (testpeer_id[0], testpeer_id[1]))
559 {
560 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "standard peer\n");
561 return cadets_running[0];
562 }
563 else
564 {
565 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "the other peer\n");
566 return cadets_running[peers_running - 1];
567 }
568
569}
570
571static unsigned int
572get_peer_nr (int outgoing)
573{
574 if (0 < GNUNET_memcmp (testpeer_id[0], testpeer_id[1]))
575 {
576 return GNUNET_YES == outgoing ? 0 : peers_running - 1;
577 }
578 else
579 {
580 return GNUNET_YES == outgoing ? peers_running - 1 : 0;
581 }
582}
519 583
520/** 584/**
521 * Task to reconnect to other peer. 585 * Task to reconnect to other peer.
@@ -534,6 +598,8 @@ reconnect_op (void *cls)
534 }; 598 };
535 long l = (long) cls; 599 long l = (long) cls;
536 struct CadetTestChannelWrapper *ch; 600 struct CadetTestChannelWrapper *ch;
601 static struct GNUNET_PeerIdentity *p_id;
602 static struct GNUNET_CADET_Handle *h1;
537 603
538 reconnect_task = NULL; 604 reconnect_task = NULL;
539 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 605 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -545,17 +611,127 @@ reconnect_op (void *cls)
545 outgoing_ch = NULL; 611 outgoing_ch = NULL;
546 } 612 }
547 ch = GNUNET_new (struct CadetTestChannelWrapper); 613 ch = GNUNET_new (struct CadetTestChannelWrapper);
614
615 p_id = get_from_p_ids ();
616 h1 = get_from_cadets ();
617
618 outgoing_ch = GNUNET_CADET_channel_create (h1,
619 ch,
620 p_id,
621 &port,
622 NULL,
623 &disconnect_handler,
624 handlers);
625 ch->ch = outgoing_ch;
626 send_test_message (outgoing_ch);
627}
628
629void
630reopen_channel ()
631{
632 struct CadetTestChannelWrapper *ch;
633 static struct GNUNET_CADET_Handle *h1;
634 static struct GNUNET_PeerIdentity *p_id;
635 struct GNUNET_MQ_MessageHandler handlers[] = {
636 GNUNET_MQ_hd_var_size (data,
637 GNUNET_MESSAGE_TYPE_DUMMY,
638 struct GNUNET_MessageHeader,
639 NULL),
640 GNUNET_MQ_handler_end ()
641 };
642
643 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "creating channel again\n");
644 p_id = get_from_p_ids ();
645 h1 = get_from_cadets ();
646
647 ch = GNUNET_new (struct CadetTestChannelWrapper);
548 outgoing_ch = GNUNET_CADET_channel_create (h1, 648 outgoing_ch = GNUNET_CADET_channel_create (h1,
549 ch, 649 ch,
550 p_id[1], 650 p_id,
551 &port, 651 &port,
552 NULL, 652 NULL,
553 &disconnect_handler, 653 &disconnect_handler,
554 handlers); 654 handlers);
555 ch->ch = outgoing_ch; 655 ch->ch = outgoing_ch;
656 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
657 "Sending second test data (after destroying the channel) on channel %p...\n",
658 outgoing_ch);
556 send_test_message (outgoing_ch); 659 send_test_message (outgoing_ch);
557} 660}
558 661
662static void
663peers_callback (void *cls, const struct GNUNET_CADET_PeerListEntry *ple);
664
665/**
666 * We ask the monitoring api for all the peers.
667 */
668static void
669get_peers (void *cls)
670{
671
672 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
673 "requesting peers info!\n");
674 plo = GNUNET_CADET_list_peers (p_cfg[get_peer_nr (GNUNET_YES)],
675 &peers_callback, NULL);
676
677}
678
679/**
680 * Method called to retrieve information about all peers in CADET, called
681 * once per peer.
682 *
683 * After last peer has been reported, an additional call with NULL is done.
684 *
685 * We check the peer we are interested in, if we have a tunnel. If not, we
686 * reopen the channel
687 *
688 * @param cls Closure.
689 * @param ple information about peer, or NULL on "EOF".
690 */
691static void
692peers_callback (void *cls, const struct GNUNET_CADET_PeerListEntry *ple)
693{
694
695 const struct GNUNET_PeerIdentity *p_id;
696 const struct GNUNET_PeerIdentity *peer;
697
698
699 peer = &ple->peer;
700
701 if (NULL == ple)
702 {
703 plo = NULL;
704 return;
705 }
706 p_id = get_from_p_ids ();
707
708 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
709 "ple->peer %s\n",
710 GNUNET_i2s_full (&ple->peer));
711 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
712 "p_id %s\n",
713 GNUNET_i2s_full (p_id));
714
715 if ((0 == GNUNET_memcmp (&ple->peer, p_id))&& ple->have_tunnel)
716 {
717
718 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
719 "schedule get_peers again?\n");
720 get_peers_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
721 &get_peers,
722 NULL);
723
724 }
725 else if (0 == GNUNET_memcmp (&ple->peer, p_id) )
726 {
727
728 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
729 "reopen channel\n");
730
731 reopen_channel ();
732
733 }
734}
559 735
560/** 736/**
561 * Function called whenever an MQ-channel is destroyed, unless the destruction 737 * Function called whenever an MQ-channel is destroyed, unless the destruction
@@ -575,9 +751,22 @@ disconnect_handler (void *cls,
575 struct CadetTestChannelWrapper *ch_w = cls; 751 struct CadetTestChannelWrapper *ch_w = cls;
576 752
577 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 753 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
578 "Channel disconnected at %d\n", 754 "Channel disconnected at ok=%d\n",
579 ok); 755 ok);
580 GNUNET_assert (ch_w->ch == channel); 756 GNUNET_assert (ch_w->ch == channel);
757
758 if ((DESTROY == test) && (3 == ok))
759 {
760 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
761 "Reopen channel task!\n");
762 if (NULL == get_peers_task)
763 {
764 get_peers_task = GNUNET_SCHEDULER_add_now (&get_peers,
765 NULL);
766 }
767 return;
768 }
769
581 if (channel == incoming_ch) 770 if (channel == incoming_ch)
582 { 771 {
583 ok++; 772 ok++;
@@ -651,8 +840,8 @@ send_test_message (struct GNUNET_CADET_Channel *channel)
651 int size; 840 int size;
652 841
653 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 842 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
654 "Sending test message on channel %p\n", 843 "Sending test message on channel %u\n",
655 channel); 844 channel->ccn.channel_of_client);
656 size = size_payload; 845 size = size_payload;
657 if (GNUNET_NO == initialized) 846 if (GNUNET_NO == initialized)
658 { 847 {
@@ -699,6 +888,10 @@ send_test_message (struct GNUNET_CADET_Channel *channel)
699 "Sending DATA %u [%d bytes]\n", 888 "Sending DATA %u [%d bytes]\n",
700 data_sent, size); 889 data_sent, size);
701 } 890 }
891 else if (DESTROY == test)
892 {
893 payload = data_sent;
894 }
702 else 895 else
703 { 896 {
704 GNUNET_assert (0); 897 GNUNET_assert (0);
@@ -826,7 +1019,7 @@ handle_data (void *cls,
826 } 1019 }
827 1020
828 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1021 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
829 " ok: (%d/%d)\n", 1022 "handle_data ok: (%d/%d)\n",
830 ok, 1023 ok,
831 ok_goal); 1024 ok_goal);
832 data = (uint32_t *) &message[1]; 1025 data = (uint32_t *) &message[1];
@@ -844,6 +1037,49 @@ handle_data (void *cls,
844 payload, *counter); 1037 payload, *counter);
845 } 1038 }
846 1039
1040 if (DESTROY == test)
1041 {
1042 if (2 == ok)
1043 {
1044 ok++;
1045 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1046 "dropping message ok: (%d/%d)\n",
1047 ok,
1048 ok_goal);
1049 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1050 "TEST ID 0: %s\n",
1051 GNUNET_i2s (testpeer_id[0]));
1052 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1053 "TEST ID 1: %s\n",
1054 GNUNET_i2s (testpeer_id[1]));
1055
1056 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "dropping message\n");
1057 GNUNET_CADET_drop_message (GNUNET_CADET_get_mq (outgoing_ch),
1058 outgoing_ch->ccn,
1059 GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
1060 if (NULL != outgoing_ch)
1061 {
1062 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1063 "Destroying channel %p...\n",
1064 outgoing_ch);
1065 GNUNET_CADET_channel_destroy (outgoing_ch);
1066 outgoing_ch = NULL;
1067 }
1068 }
1069 else if (5 == ok)
1070 {
1071 ok++;
1072 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1073 "destroy test finished ok: (%d/%d)\n",
1074 ok,
1075 ok_goal);
1076 disconnect_task =
1077 GNUNET_SCHEDULER_add_now (&gather_stats_and_exit,
1078 (void *) __LINE__);
1079 // End of DESTROY test.
1080 }
1081 }
1082
847 if (GNUNET_NO == initialized) 1083 if (GNUNET_NO == initialized)
848 { 1084 {
849 initialized = GNUNET_YES; 1085 initialized = GNUNET_YES;
@@ -861,7 +1097,7 @@ handle_data (void *cls,
861 if (get_target_channel () == channel) /* Got "data" */ 1097 if (get_target_channel () == channel) /* Got "data" */
862 { 1098 {
863 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received data %u\n", data_received); 1099 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received data %u\n", data_received);
864 if ((SPEED != test) || ( (ok_goal - 2) == ok) ) 1100 if ((DESTROY != test) && ((SPEED != test) || ( (ok_goal - 2) == ok)) )
865 { 1101 {
866 /* Send ACK */ 1102 /* Send ACK */
867 send_test_message (channel); 1103 send_test_message (channel);
@@ -927,11 +1163,13 @@ connect_handler (void *cls,
927 channel); 1163 channel);
928 ok++; 1164 ok++;
929 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1165 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
930 " ok: %d\n", 1166 "connect_handler ok: (%d/%d)\n",
931 ok); 1167 ok,
932 if (peer == peers_requested - 1) 1168 ok_goal);
1169
1170 if (peer == get_peer_nr (GNUNET_NO))
933 { 1171 {
934 if (NULL != incoming_ch) 1172 if ((DESTROY != test)&&(NULL != incoming_ch))
935 { 1173 {
936 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1174 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
937 "Duplicate incoming channel for client %lu\n", 1175 "Duplicate incoming channel for client %lu\n",
@@ -947,7 +1185,7 @@ connect_handler (void *cls,
947 (long) cls); 1185 (long) cls);
948 GNUNET_assert (0); 1186 GNUNET_assert (0);
949 } 1187 }
950 if ((NULL != disconnect_task) && (REOPEN != test)) 1188 if ((NULL != disconnect_task) && (REOPEN != test) && (DESTROY != test))
951 { 1189 {
952 GNUNET_SCHEDULER_cancel (disconnect_task); 1190 GNUNET_SCHEDULER_cancel (disconnect_task);
953 disconnect_task = GNUNET_SCHEDULER_add_delayed (short_time, 1191 disconnect_task = GNUNET_SCHEDULER_add_delayed (short_time,
@@ -971,6 +1209,7 @@ connect_handler (void *cls,
971 (void *) __LINE__); 1209 (void *) __LINE__);
972 } 1210 }
973 1211
1212
974 /* TODO: cannot return channel as-is, in order to unify the data handlers */ 1213 /* TODO: cannot return channel as-is, in order to unify the data handlers */
975 ch = GNUNET_new (struct CadetTestChannelWrapper); 1214 ch = GNUNET_new (struct CadetTestChannelWrapper);
976 ch->ch = channel; 1215 ch->ch = channel;
@@ -998,6 +1237,8 @@ start_test (void *cls)
998 GNUNET_MQ_handler_end () 1237 GNUNET_MQ_handler_end ()
999 }; 1238 };
1000 struct CadetTestChannelWrapper *ch; 1239 struct CadetTestChannelWrapper *ch;
1240 static struct GNUNET_CADET_Handle *h1;
1241 static struct GNUNET_PeerIdentity *p_id;
1001 1242
1002 test_task = NULL; 1243 test_task = NULL;
1003 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "start_test: %s\n", test_name); 1244 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "start_test: %s\n", test_name);
@@ -1012,20 +1253,25 @@ start_test (void *cls)
1012 test = SPEED; 1253 test = SPEED;
1013 } 1254 }
1014 1255
1256 p_id = get_from_p_ids ();
1257 h1 = get_from_cadets ();
1258
1015 ch = GNUNET_new (struct CadetTestChannelWrapper); 1259 ch = GNUNET_new (struct CadetTestChannelWrapper);
1016 outgoing_ch = GNUNET_CADET_channel_create (h1, 1260 outgoing_ch = GNUNET_CADET_channel_create (h1,
1017 ch, 1261 ch,
1018 p_id[1], 1262 p_id,
1019 &port, 1263 &port,
1020 NULL, 1264 NULL,
1021 &disconnect_handler, 1265 &disconnect_handler,
1022 handlers); 1266 handlers);
1267 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "channel created\n");
1023 1268
1024 ch->ch = outgoing_ch; 1269 ch->ch = outgoing_ch;
1025 1270
1026 disconnect_task = GNUNET_SCHEDULER_add_delayed (short_time, 1271 if (DESTROY != test)
1027 &gather_stats_and_exit, 1272 disconnect_task = GNUNET_SCHEDULER_add_delayed (short_time,
1028 (void *) __LINE__); 1273 &gather_stats_and_exit,
1274 (void *) __LINE__);
1029 if (KEEPALIVE == test) 1275 if (KEEPALIVE == test)
1030 return; /* Don't send any data. */ 1276 return; /* Don't send any data. */
1031 1277
@@ -1054,7 +1300,7 @@ start_test (void *cls)
1054/** 1300/**
1055 * Callback to be called when the requested peer information is available 1301 * Callback to be called when the requested peer information is available
1056 * 1302 *
1057 * @param cls the closure from GNUNET_TESTBED_peer_get_information() 1303 * @param cls the closure from GNUNET_TESTBED_peer_getinformation()
1058 * @param op the operation this callback corresponds to 1304 * @param op the operation this callback corresponds to
1059 * @param pinfo the result; will be NULL if the operation has failed 1305 * @param pinfo the result; will be NULL if the operation has failed
1060 * @param emsg error message if the operation has failed; 1306 * @param emsg error message if the operation has failed;
@@ -1068,9 +1314,6 @@ pi_cb (void *cls,
1068{ 1314{
1069 long i = (long) cls; 1315 long i = (long) cls;
1070 1316
1071 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1072 "ID callback for %ld\n",
1073 i);
1074 if ((NULL == pinfo) || 1317 if ((NULL == pinfo) ||
1075 (NULL != emsg)) 1318 (NULL != emsg))
1076 { 1319 {
@@ -1080,15 +1323,40 @@ pi_cb (void *cls,
1080 abort_test (__LINE__); 1323 abort_test (__LINE__);
1081 return; 1324 return;
1082 } 1325 }
1083 p_id[i] = pinfo->result.id; 1326
1084 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1327 if (GNUNET_TESTBED_PIT_IDENTITY == pinfo->pit)
1085 "id: %s\n", 1328 {
1086 GNUNET_i2s (p_id[i])); 1329 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1087 p_ids++; 1330 "ID callback for %ld\n",
1088 if (p_ids < 2) 1331 i);
1332 testpeer_id[i] = pinfo->result.id;
1333 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1334 "id: %s\n",
1335 GNUNET_i2s (testpeer_id[i]));
1336 }
1337 else if (GNUNET_TESTBED_PIT_CONFIGURATION == pinfo->pit)
1338 {
1339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1340 "CFG callback for %ld\n",
1341 i);
1342 p_cfg[i] = pinfo->result.cfg;
1343 }
1344 else
1345 {
1346 GNUNET_break (0);
1347 }
1348
1349 peerinfo_task_cnt++;
1350 if (peerinfo_task_cnt < 4)
1089 return; 1351 return;
1090 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1352 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1091 "Got all IDs, starting test\n"); 1353 "Got all peer information, starting test\n");
1354 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1355 "TEST ID 0: %s\n",
1356 GNUNET_i2s (testpeer_id[0]));
1357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1358 "TEST ID 1: %s\n",
1359 GNUNET_i2s (testpeer_id[1]));
1092 test_task = GNUNET_SCHEDULER_add_now (&start_test, NULL); 1360 test_task = GNUNET_SCHEDULER_add_now (&start_test, NULL);
1093} 1361}
1094 1362
@@ -1115,8 +1383,8 @@ tmain (void *cls,
1115 peers_running = num_peers; 1383 peers_running = num_peers;
1116 GNUNET_assert (peers_running == peers_requested); 1384 GNUNET_assert (peers_running == peers_requested);
1117 testbed_peers = peers; 1385 testbed_peers = peers;
1118 h1 = cadets[0]; 1386 cadets_running = cadets;
1119 h2 = cadets[num_peers - 1]; 1387
1120 disconnect_task = GNUNET_SCHEDULER_add_delayed (short_time, 1388 disconnect_task = GNUNET_SCHEDULER_add_delayed (short_time,
1121 &disconnect_cadet_peers, 1389 &disconnect_cadet_peers,
1122 (void *) __LINE__); 1390 (void *) __LINE__);
@@ -1130,6 +1398,14 @@ tmain (void *cls,
1130 GNUNET_TESTBED_PIT_IDENTITY, 1398 GNUNET_TESTBED_PIT_IDENTITY,
1131 &pi_cb, 1399 &pi_cb,
1132 (void *) 1L); 1400 (void *) 1L);
1401 t_op[0] = GNUNET_TESTBED_peer_get_information (peers[0],
1402 GNUNET_TESTBED_PIT_CONFIGURATION,
1403 &pi_cb,
1404 (void *) 0L);
1405 t_op[1] = GNUNET_TESTBED_peer_get_information (peers[num_peers - 1],
1406 GNUNET_TESTBED_PIT_CONFIGURATION,
1407 &pi_cb,
1408 (void *) 1L);
1133 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requested peer ids\n"); 1409 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requested peer ids\n");
1134} 1410}
1135 1411
@@ -1272,6 +1548,13 @@ main (int argc, char *argv[])
1272 // */ 1548 // */
1273 ok_goal = 6; 1549 ok_goal = 6;
1274 } 1550 }
1551 else if (strstr (argv[0], "_destroy") != NULL)
1552 {
1553 test = DESTROY;
1554 test_name = "destroy";
1555 ok_goal = 6;
1556 short_time = GNUNET_TIME_relative_multiply (short_time, 5);
1557 }
1275 else 1558 else
1276 { 1559 {
1277 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "UNKNOWN\n"); 1560 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "UNKNOWN\n");
@@ -1286,7 +1569,7 @@ main (int argc, char *argv[])
1286 GNUNET_asprintf (&test_name, "backwards %s", test_name); 1569 GNUNET_asprintf (&test_name, "backwards %s", test_name);
1287 } 1570 }
1288 1571
1289 p_ids = 0; 1572 peerinfo_task_cnt = 0;
1290 ports[0] = &port; 1573 ports[0] = &port;
1291 ports[1] = NULL; 1574 ports[1] = NULL;
1292 GNUNET_CADET_TEST_ruN ("test_cadet_small", 1575 GNUNET_CADET_TEST_ruN ("test_cadet_small",