From 49c5ab46eb8f1718446b90e81b89d2e709739c89 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Wed, 10 Jul 2019 18:28:33 +0200 Subject: [PATCH] fixed broken api calls in test; fixed broken protocol --- src/cadet/gnunet-cadet-profiler.c | 7 +++---- src/cadet/gnunet-service-cadet_channel.c | 23 +++++++++++++++++++++ src/cadet/gnunet-service-cadet_connection.c | 2 ++ src/cadet/test_cadet.c | 7 ------- src/cadet/test_cadet_local_mq.c | 1 - 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/cadet/gnunet-cadet-profiler.c b/src/cadet/gnunet-cadet-profiler.c index 920d8d830..2de17dc9e 100644 --- a/src/cadet/gnunet-cadet-profiler.c +++ b/src/cadet/gnunet-cadet-profiler.c @@ -912,19 +912,18 @@ select_random_peer (struct CadetPeer *peer) static void start_test (void *cls) { - enum GNUNET_CADET_ChannelOption flags; unsigned long i; test_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start profiler\n"); - flags = GNUNET_CADET_OPTION_DEFAULT; + for (i = 0; i < peers_pinging; i++) { peers[i].dest = select_random_peer (&peers[i]); peers[i].ch = GNUNET_CADET_channel_create (peers[i].cadet, NULL, &peers[i].dest->id, - GC_u2h (1), flags); + GC_u2h (1)); if (NULL == peers[i].ch) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Channel %lu failed\n", i); @@ -969,7 +968,7 @@ warmup (void) i, get_index (peer)); peers[i].warmup_ch = GNUNET_CADET_channel_create (peers[i].cadet, NULL, &peer->id, - GC_u2h (1), GNUNET_CADET_OPTION_DEFAULT); + GC_u2h (1)); if (NULL == peers[i].warmup_ch) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Warmup %u failed\n", i); diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 6e3f6ee5e..847a217c7 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c @@ -354,6 +354,21 @@ struct CadetChannel */ unsigned int skip_ack_series; + /** + * Is the tunnel bufferless (minimum latency)? + */ + int nobuffer; + + /** + * Is the tunnel reliable? + */ + int reliable; + + /** + * Is the tunnel out-of-order? + */ + int out_of_order; + /** * Is this channel a loopback channel, where the destination is us again? */ @@ -583,6 +598,8 @@ send_channel_open (void *cls) GCCH_2s (ch)); msgcc.header.size = htons (sizeof (msgcc)); msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); + //TODO This will be removed in a major release, because this will be a protocol breaking change. We shift here to be compatible with GNUNET_CADET_OPTION_RELIABLE that was removed, and to already use the newly introduced options. + msgcc.opt = GNUNET_MQ_PREF_RELIABLE >> 10; msgcc.h_port = ch->h_port; msgcc.ctn = ch->ctn; ch->state = CADET_CHANNEL_OPEN_SENT; @@ -646,6 +663,9 @@ GCCH_channel_local_new (struct CadetClient *owner, ch = GNUNET_new (struct CadetChannel); ch->mid_recv.mid = htonl (1); /* The OPEN_ACK counts as message 0! */ + ch->nobuffer = GNUNET_NO ; + ch->reliable = GNUNET_YES; + ch->out_of_order = GNUNET_NO ; ch->max_pending_messages = (ch->nobuffer) ? 1 : 4; /* FIXME: 4!? Do not hardcode! */ ch->owner = ccco; ch->port = *port; @@ -744,6 +764,9 @@ GCCH_channel_incoming_new (struct CadetTunnel *t, ch->t = t; ch->ctn = ctn; ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME; + ch->nobuffer = GNUNET_NO; + ch->reliable = GNUNET_YES; + ch->out_of_order = GNUNET_NO; ch->max_pending_messages = (ch->nobuffer) ? 1 : 4; /* FIXME: 4!? Do not hardcode! */ GNUNET_STATISTICS_update (stats, "# channels", diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 7b3a0b975..7214dad97 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c @@ -630,6 +630,8 @@ send_create (void *cls) env = GNUNET_MQ_msg_extra (create_msg, (2 + cc->off) * sizeof (struct GNUNET_PeerIdentity), GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE); + //TODO This will be removed in a major release, because this will be a protocol breaking change. We shift here to be compatible with GNUNET_CADET_OPTION_RELIABLE that was removed, and to already use the newly introduced options. + create_msg->options = GNUNET_MQ_PREF_RELIABLE >> 10; create_msg->cid = cc->cid; pids = (struct GNUNET_PeerIdentity *) &create_msg[1]; pids[0] = my_full_id; diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index 72c18cf9c..e87e173be 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c @@ -532,7 +532,6 @@ reconnect_op (void *cls) }; long l = (long) cls; struct CadetTestChannelWrapper *ch; - enum GNUNET_CADET_ChannelOption flags; reconnect_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -543,13 +542,11 @@ reconnect_op (void *cls) GNUNET_CADET_channel_destroy (outgoing_ch); outgoing_ch = NULL; } - flags = GNUNET_CADET_OPTION_DEFAULT; ch = GNUNET_new (struct CadetTestChannelWrapper); outgoing_ch = GNUNET_CADET_channel_create (h1, ch, p_id[1], &port, - flags, NULL, &disconnect_handler, handlers); @@ -998,7 +995,6 @@ start_test (void *cls) GNUNET_MQ_handler_end () }; struct CadetTestChannelWrapper *ch; - enum GNUNET_CADET_ChannelOption flags; test_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "start_test: %s\n", test_name); @@ -1008,11 +1004,9 @@ start_test (void *cls) disconnect_task = NULL; } - flags = GNUNET_CADET_OPTION_DEFAULT; if (SPEED_REL == test) { test = SPEED; - flags |= GNUNET_CADET_OPTION_RELIABLE; } ch = GNUNET_new (struct CadetTestChannelWrapper); @@ -1020,7 +1014,6 @@ start_test (void *cls) ch, p_id[1], &port, - flags, NULL, &disconnect_handler, handlers); diff --git a/src/cadet/test_cadet_local_mq.c b/src/cadet/test_cadet_local_mq.c index fc5561044..b2fed5bd6 100644 --- a/src/cadet/test_cadet_local_mq.c +++ b/src/cadet/test_cadet_local_mq.c @@ -243,7 +243,6 @@ do_connect (void *cls) NULL, /* channel cls */ &id, /* destination */ GC_u2h (TEST_MESSAGE_TYPE), /* port */ - GNUNET_CADET_OPTION_DEFAULT, /* opt */ NULL, /* window change */ &disconnected, /* disconnect handler */ handlers /* traffic handlers */ -- 2.25.1