aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/test_cadet.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2016-07-20 12:07:05 +0000
committerBart Polot <bart@net.in.tum.de>2016-07-20 12:07:05 +0000
commitdbb12b0c0216846ec0cfa30ed2760c221434eaee (patch)
tree140b649ad916e45f17faa42a5ba5cdf3563b2e52 /src/cadet/test_cadet.c
parentcaa4196867da8684c5b1fd2e747ecb9d21cbba8b (diff)
downloadgnunet-dbb12b0c0216846ec0cfa30ed2760c221434eaee.tar.gz
gnunet-dbb12b0c0216846ec0cfa30ed2760c221434eaee.zip
- adapt test cases / framework to new port system
Diffstat (limited to 'src/cadet/test_cadet.c')
-rw-r--r--src/cadet/test_cadet.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c
index 557524ca3..e2d3902e5 100644
--- a/src/cadet/test_cadet.c
+++ b/src/cadet/test_cadet.c
@@ -97,6 +97,11 @@ struct GNUNET_TESTBED_Operation *t_op[2];
97struct GNUNET_PeerIdentity *p_id[2]; 97struct GNUNET_PeerIdentity *p_id[2];
98 98
99/** 99/**
100 * Port ID
101 */
102struct GNUNET_HashCode port;
103
104/**
100 * Peer ids counter. 105 * Peer ids counter.
101 */ 106 */
102unsigned int p_ids; 107unsigned int p_ids;
@@ -761,12 +766,13 @@ static struct GNUNET_CADET_MessageHandler handlers[] = {
761static void * 766static void *
762incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, 767incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel,
763 const struct GNUNET_PeerIdentity *initiator, 768 const struct GNUNET_PeerIdentity *initiator,
764 uint32_t port, enum GNUNET_CADET_ChannelOption options) 769 const struct GNUNET_HashCode *port,
770 enum GNUNET_CADET_ChannelOption options)
765{ 771{
766 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 772 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
767 "Incoming channel from %s to peer %d\n", 773 "Incoming channel from %s to peer %d:%s\n",
768 GNUNET_i2s (initiator), 774 GNUNET_i2s (initiator),
769 (int) (long) cls); 775 (int) (long) cls, GNUNET_h2s (port));
770 ok++; 776 ok++;
771 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); 777 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
772 if ((long) cls == peers_requested - 1) 778 if ((long) cls == peers_requested - 1)
@@ -865,7 +871,8 @@ do_test (void *cls)
865 test = SPEED; 871 test = SPEED;
866 flags |= GNUNET_CADET_OPTION_RELIABLE; 872 flags |= GNUNET_CADET_OPTION_RELIABLE;
867 } 873 }
868 ch = GNUNET_CADET_channel_create (h1, NULL, p_id[1], 1, flags); 874
875 ch = GNUNET_CADET_channel_create (h1, NULL, p_id[1], &port, flags);
869 876
870 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, 877 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
871 &gather_stats_and_exit, 878 &gather_stats_and_exit,
@@ -965,8 +972,10 @@ int
965main (int argc, char *argv[]) 972main (int argc, char *argv[])
966{ 973{
967 initialized = GNUNET_NO; 974 initialized = GNUNET_NO;
968 static uint32_t ports[2]; 975 static const struct GNUNET_HashCode *ports[2];
969 const char *config_file; 976 const char *config_file;
977 char port_id[] = "test port";
978 GNUNET_CRYPTO_hash (port_id, sizeof (port_id), &port);
970 979
971 GNUNET_log_setup ("test", "DEBUG", NULL); 980 GNUNET_log_setup ("test", "DEBUG", NULL);
972 config_file = "test_cadet.conf"; 981 config_file = "test_cadet.conf";
@@ -1066,8 +1075,8 @@ main (int argc, char *argv[])
1066 } 1075 }
1067 1076
1068 p_ids = 0; 1077 p_ids = 0;
1069 ports[0] = 1; 1078 ports[0] = &port;
1070 ports[1] = 0; 1079 ports[1] = NULL;
1071 GNUNET_CADET_TEST_run ("test_cadet_small", 1080 GNUNET_CADET_TEST_run ("test_cadet_small",
1072 config_file, 1081 config_file,
1073 peers_requested, 1082 peers_requested,