aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNils Gillmann <ng0@n0.is>2018-05-23 08:12:08 +0000
committerNils Gillmann <ng0@n0.is>2018-05-23 08:12:08 +0000
commit78eeba903d3cd5ccde3b2fffa52d7120f5b09fd2 (patch)
tree8dfc823ecd64d5ca43e05a3a617743bffedbffa9 /src
parent1cc13d48eb2b1fd1763a49abf70816ec8d9feb57 (diff)
parent8d7ab16402048793275b6feebd744e5e17af63fb (diff)
downloadgnunet-78eeba903d3cd5ccde3b2fffa52d7120f5b09fd2.tar.gz
gnunet-78eeba903d3cd5ccde3b2fffa52d7120f5b09fd2.zip
Merge branch 'master' of gnunet.org:gnunet
Diffstat (limited to 'src')
-rw-r--r--src/cadet/cadet_test_lib.c65
-rw-r--r--src/cadet/test_cadet.c52
-rw-r--r--src/cadet/test_cadet_flow.c888
-rw-r--r--src/cadet/test_cadet_local_mq.c12
-rw-r--r--src/dht/gnunet_dht_profiler.c4
-rw-r--r--src/gns/gnunet-gns-benchmark.c3
6 files changed, 972 insertions, 52 deletions
diff --git a/src/cadet/cadet_test_lib.c b/src/cadet/cadet_test_lib.c
index 20ef028b2..0efb81ab4 100644
--- a/src/cadet/cadet_test_lib.c
+++ b/src/cadet/cadet_test_lib.c
@@ -110,7 +110,7 @@ struct GNUNET_CADET_TEST_AdapterContext
110 * Port handlers for open ports. 110 * Port handlers for open ports.
111 */ 111 */
112 struct GNUNET_CADET_Port **ports; 112 struct GNUNET_CADET_Port **ports;
113 113
114 /** 114 /**
115 * General context. 115 * General context.
116 */ 116 */
@@ -135,14 +135,13 @@ cadet_connect_adapter (void *cls,
135 struct GNUNET_CADET_TEST_AdapterContext *actx = cls; 135 struct GNUNET_CADET_TEST_AdapterContext *actx = cls;
136 struct GNUNET_CADET_TEST_Context *ctx = actx->ctx; 136 struct GNUNET_CADET_TEST_Context *ctx = actx->ctx;
137 struct GNUNET_CADET_Handle *h; 137 struct GNUNET_CADET_Handle *h;
138 unsigned int i;
139 138
140 h = GNUNET_CADET_connect (cfg); 139 h = GNUNET_CADET_connect (cfg);
141 if (NULL == ctx->ports) 140 if (NULL == ctx->ports)
142 return h; 141 return h;
143 142 actx->ports = GNUNET_new_array (ctx->port_count,
144 actx->ports = GNUNET_new_array (ctx->port_count, struct GNUNET_CADET_Port *); 143 struct GNUNET_CADET_Port *);
145 for (i = 0; i < ctx->port_count; i++) 144 for (unsigned int i = 0; i < ctx->port_count; i++)
146 { 145 {
147 actx->ports[i] = GNUNET_CADET_open_port (h, 146 actx->ports[i] = GNUNET_CADET_open_port (h,
148 ctx->ports[i], 147 ctx->ports[i],
@@ -165,14 +164,14 @@ cadet_connect_adapter (void *cls,
165 */ 164 */
166static void 165static void
167cadet_disconnect_adapter (void *cls, 166cadet_disconnect_adapter (void *cls,
168 void *op_result) 167 void *op_result)
169{ 168{
170 struct GNUNET_CADET_Handle *cadet = op_result; 169 struct GNUNET_CADET_Handle *cadet = op_result;
171 struct GNUNET_CADET_TEST_AdapterContext *actx = cls; 170 struct GNUNET_CADET_TEST_AdapterContext *actx = cls;
172 171
173 if (NULL != actx->ports) 172 if (NULL != actx->ports)
174 { 173 {
175 for (int i = 0; i < actx->ctx->port_count; i++) 174 for (unsigned int i = 0; i < actx->ctx->port_count; i++)
176 { 175 {
177 GNUNET_CADET_close_port (actx->ports[i]); 176 GNUNET_CADET_close_port (actx->ports[i]);
178 actx->ports[i] = NULL; 177 actx->ports[i] = NULL;
@@ -201,22 +200,24 @@ cadet_connect_cb (void *cls,
201 const char *emsg) 200 const char *emsg)
202{ 201{
203 struct GNUNET_CADET_TEST_Context *ctx = cls; 202 struct GNUNET_CADET_TEST_Context *ctx = cls;
204 unsigned int i;
205 203
206 if (NULL != emsg) 204 if (NULL != emsg)
207 { 205 {
208 fprintf (stderr, "Failed to connect to CADET service: %s\n", 206 fprintf (stderr,
207 "Failed to connect to CADET service: %s\n",
209 emsg); 208 emsg);
210 GNUNET_SCHEDULER_shutdown (); 209 GNUNET_SCHEDULER_shutdown ();
211 return; 210 return;
212 } 211 }
213 for (i = 0; i < ctx->num_peers; i++) 212 for (unsigned int i = 0; i < ctx->num_peers; i++)
214 if (op == ctx->ops[i]) 213 if (op == ctx->ops[i])
215 { 214 {
216 ctx->cadets[i] = ca_result; 215 ctx->cadets[i] = ca_result;
217 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "...cadet %u connected\n", i); 216 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
217 "...cadet %u connected\n",
218 i);
218 } 219 }
219 for (i = 0; i < ctx->num_peers; i++) 220 for (unsigned int i = 0; i < ctx->num_peers; i++)
220 if (NULL == ctx->cadets[i]) 221 if (NULL == ctx->cadets[i])
221 return; /* still some CADET connections missing */ 222 return; /* still some CADET connections missing */
222 /* all CADET connections ready! */ 223 /* all CADET connections ready! */
@@ -231,9 +232,7 @@ cadet_connect_cb (void *cls,
231void 232void
232GNUNET_CADET_TEST_cleanup (struct GNUNET_CADET_TEST_Context *ctx) 233GNUNET_CADET_TEST_cleanup (struct GNUNET_CADET_TEST_Context *ctx)
233{ 234{
234 unsigned int i; 235 for (unsigned int i = 0; i < ctx->num_peers; i++)
235
236 for (i = 0; i < ctx->num_peers; i++)
237 { 236 {
238 GNUNET_assert (NULL != ctx->ops[i]); 237 GNUNET_assert (NULL != ctx->ops[i]);
239 GNUNET_TESTBED_operation_done (ctx->ops[i]); 238 GNUNET_TESTBED_operation_done (ctx->ops[i]);
@@ -269,33 +268,37 @@ cadet_test_run (void *cls,
269 unsigned int links_failed) 268 unsigned int links_failed)
270{ 269{
271 struct GNUNET_CADET_TEST_Context *ctx = cls; 270 struct GNUNET_CADET_TEST_Context *ctx = cls;
272 unsigned int i;
273 271
274 if (0 != links_failed) 272 if (0 != links_failed)
275 { 273 {
276 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Some links failed (%u), ending\n", 274 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
275 "Some links failed (%u), ending\n",
277 links_failed); 276 links_failed);
278 exit (2); 277 exit (2);
279 } 278 }
280
281 if (num_peers != ctx->num_peers) 279 if (num_peers != ctx->num_peers)
282 { 280 {
283 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers started %u/%u, ending\n", 281 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
284 num_peers, ctx->num_peers); 282 "Peers started %u/%u, ending\n",
283 num_peers,
284 ctx->num_peers);
285 exit (1); 285 exit (1);
286 } 286 }
287
288 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 287 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
289 "Testbed up, %u peers and %u links\n", 288 "Testbed up, %u peers and %u links\n",
290 num_peers, links_succeeded); 289 num_peers,
290 links_succeeded);
291 ctx->peers = peers; 291 ctx->peers = peers;
292 for (i = 0; i < num_peers; i++) 292 for (unsigned int i = 0; i < num_peers; i++)
293 { 293 {
294 struct GNUNET_CADET_TEST_AdapterContext *newctx; 294 struct GNUNET_CADET_TEST_AdapterContext *newctx;
295
295 newctx = GNUNET_new (struct GNUNET_CADET_TEST_AdapterContext); 296 newctx = GNUNET_new (struct GNUNET_CADET_TEST_AdapterContext);
296 newctx->peer = i; 297 newctx->peer = i;
297 newctx->ctx = ctx; 298 newctx->ctx = ctx;
298 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connecting to cadet %u\n", i); 299 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
300 "Connecting to cadet %u\n",
301 i);
299 ctx->ops[i] = GNUNET_TESTBED_service_connect (ctx, 302 ctx->ops[i] = GNUNET_TESTBED_service_connect (ctx,
300 peers[i], 303 peers[i],
301 "cadet", 304 "cadet",
@@ -304,7 +307,9 @@ cadet_test_run (void *cls,
304 &cadet_connect_adapter, 307 &cadet_connect_adapter,
305 &cadet_disconnect_adapter, 308 &cadet_disconnect_adapter,
306 newctx); 309 newctx);
307 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "op handle %p\n", ctx->ops[i]); 310 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
311 "op handle %p\n",
312 ctx->ops[i]);
308 } 313 }
309} 314}
310 315
@@ -340,8 +345,10 @@ GNUNET_CADET_TEST_ruN (const char *testname,
340 345
341 ctx = GNUNET_new (struct GNUNET_CADET_TEST_Context); 346 ctx = GNUNET_new (struct GNUNET_CADET_TEST_Context);
342 ctx->num_peers = num_peers; 347 ctx->num_peers = num_peers;
343 ctx->ops = GNUNET_new_array (num_peers, struct GNUNET_TESTBED_Operation *); 348 ctx->ops = GNUNET_new_array (num_peers,
344 ctx->cadets = GNUNET_new_array (num_peers, struct GNUNET_CADET_Handle *); 349 struct GNUNET_TESTBED_Operation *);
350 ctx->cadets = GNUNET_new_array (num_peers,
351 struct GNUNET_CADET_Handle *);
345 ctx->app_main = tmain; 352 ctx->app_main = tmain;
346 ctx->app_main_cls = tmain_cls; 353 ctx->app_main_cls = tmain_cls;
347 ctx->connects = connects; 354 ctx->connects = connects;
@@ -352,12 +359,12 @@ GNUNET_CADET_TEST_ruN (const char *testname,
352 ctx->port_count = 0; 359 ctx->port_count = 0;
353 while (NULL != ctx->ports[ctx->port_count]) 360 while (NULL != ctx->ports[ctx->port_count])
354 ctx->port_count++; 361 ctx->port_count++;
355
356 GNUNET_TESTBED_test_run (testname, 362 GNUNET_TESTBED_test_run (testname,
357 cfgfile, 363 cfgfile,
358 num_peers, 364 num_peers,
359 0LL, NULL, NULL, 365 0LL, NULL, NULL,
360 &cadet_test_run, ctx); 366 &cadet_test_run,
367 ctx);
361} 368}
362 369
363/* end of cadet_test_lib.c */ 370/* end of cadet_test_lib.c */
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c
index b9f177652..608136e56 100644
--- a/src/cadet/test_cadet.c
+++ b/src/cadet/test_cadet.c
@@ -402,8 +402,11 @@ stats_cont (void *cls,
402 * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration 402 * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
403 */ 403 */
404static int 404static int
405stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer, 405stats_iterator (void *cls,
406 const char *subsystem, const char *name, uint64_t value, 406 const struct GNUNET_TESTBED_Peer *peer,
407 const char *subsystem,
408 const char *name,
409 uint64_t value,
407 int is_persistent) 410 int is_persistent)
408{ 411{
409 static const char *s_sent = "# keepalives sent"; 412 static const char *s_sent = "# keepalives sent";
@@ -614,10 +617,9 @@ reschedule_timeout_task (long line)
614 * #GNUNET_SYSERR to close it (signal serious error). 617 * #GNUNET_SYSERR to close it (signal serious error).
615 */ 618 */
616static int 619static int
617check_data (void *cls, const struct GNUNET_MessageHeader *message) 620check_data (void *cls,
621 const struct GNUNET_MessageHeader *message)
618{ 622{
619 if (sizeof (struct GNUNET_MessageHeader) >= ntohs (message->size))
620 return GNUNET_SYSERR;
621 return GNUNET_OK; /* all is well-formed */ 623 return GNUNET_OK; /* all is well-formed */
622} 624}
623 625
@@ -646,24 +648,33 @@ handle_data (void *cls,
646 648
647 if (channel == outgoing_ch) 649 if (channel == outgoing_ch)
648 { 650 {
649 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Root client got a message.\n"); 651 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
652 "Root client got a message.\n");
650 } 653 }
651 else if (channel == incoming_ch) 654 else if (channel == incoming_ch)
652 { 655 {
653 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Leaf client got a message.\n"); 656 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
657 "Leaf client got a message.\n");
654 } 658 }
655 else 659 else
656 { 660 {
657 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unknown channel %p.\n", channel); 661 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
662 "Unknown channel %p.\n",
663 channel);
658 GNUNET_assert (0); 664 GNUNET_assert (0);
659 } 665 }
660 666
661 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: (%d/%d)\n", ok, ok_goal); 667 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
668 " ok: (%d/%d)\n",
669 ok,
670 ok_goal);
662 data = (uint32_t *) &message[1]; 671 data = (uint32_t *) &message[1];
663 payload = ntohl (*data); 672 payload = ntohl (*data);
664 if (payload == *counter) 673 if (payload == *counter)
665 { 674 {
666 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " payload as expected: %u\n", payload); 675 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
676 " payload as expected: %u\n",
677 payload);
667 } 678 }
668 else 679 else
669 { 680 {
@@ -679,7 +690,8 @@ handle_data (void *cls,
679 if (SPEED == test) 690 if (SPEED == test)
680 { 691 {
681 GNUNET_assert (incoming_ch == channel); 692 GNUNET_assert (incoming_ch == channel);
682 send_next_msg_task = GNUNET_SCHEDULER_add_now (&send_next_msg, NULL); 693 send_next_msg_task = GNUNET_SCHEDULER_add_now (&send_next_msg,
694 NULL);
683 return; 695 return;
684 } 696 }
685 } 697 }
@@ -740,7 +752,8 @@ handle_data (void *cls,
740 * received on the @a channel. 752 * received on the @a channel.
741 */ 753 */
742static void * 754static void *
743connect_handler (void *cls, struct GNUNET_CADET_Channel *channel, 755connect_handler (void *cls,
756 struct GNUNET_CADET_Channel *channel,
744 const struct GNUNET_PeerIdentity *source) 757 const struct GNUNET_PeerIdentity *source)
745{ 758{
746 struct CadetTestChannelWrapper *ch; 759 struct CadetTestChannelWrapper *ch;
@@ -748,15 +761,20 @@ connect_handler (void *cls, struct GNUNET_CADET_Channel *channel,
748 761
749 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 762 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
750 "Incoming channel from %s to %ld: %p\n", 763 "Incoming channel from %s to %ld: %p\n",
751 GNUNET_i2s (source), peer, channel); 764 GNUNET_i2s (source),
765 peer,
766 channel);
752 ok++; 767 ok++;
753 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); 768 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
769 " ok: %d\n",
770 ok);
754 if (peer == peers_requested - 1) 771 if (peer == peers_requested - 1)
755 { 772 {
756 if (NULL != incoming_ch) 773 if (NULL != incoming_ch)
757 { 774 {
758 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 775 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
759 "Duplicate incoming channel for client %lu\n", (long) cls); 776 "Duplicate incoming channel for client %lu\n",
777 (long) cls);
760 GNUNET_assert (0); 778 GNUNET_assert (0);
761 } 779 }
762 incoming_ch = channel; 780 incoming_ch = channel;
@@ -764,7 +782,8 @@ connect_handler (void *cls, struct GNUNET_CADET_Channel *channel,
764 else 782 else
765 { 783 {
766 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 784 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
767 "Incoming channel for unexpected peer #%lu\n", (long) cls); 785 "Incoming channel for unexpected peer #%lu\n",
786 (long) cls);
768 GNUNET_assert (0); 787 GNUNET_assert (0);
769 } 788 }
770 if (NULL != disconnect_task) 789 if (NULL != disconnect_task)
@@ -1003,7 +1022,6 @@ main (int argc, char *argv[])
1003 "short_time", 1022 "short_time",
1004 gettext_noop ("set short timeout"), 1023 gettext_noop ("set short timeout"),
1005 &short_time), 1024 &short_time),
1006
1007 GNUNET_GETOPT_option_uint ('m', 1025 GNUNET_GETOPT_option_uint ('m',
1008 "messages", 1026 "messages",
1009 "NUM_MESSAGES", 1027 "NUM_MESSAGES",
diff --git a/src/cadet/test_cadet_flow.c b/src/cadet/test_cadet_flow.c
new file mode 100644
index 000000000..554ee1d85
--- /dev/null
+++ b/src/cadet/test_cadet_flow.c
@@ -0,0 +1,888 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2011, 2017 GNUnet e.V.
4
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
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20/**
21 * @file cadet/test_cadet_flow.c
22 * @author Bart Polot
23 * @author Christian Grothoff
24 * @brief Test for flow control of CADET service
25 */
26#include <stdio.h>
27#include "platform.h"
28#include "cadet_test_lib.h"
29#include "gnunet_cadet_service.h"
30#include "gnunet_statistics_service.h"
31#include <gauger.h>
32
33
34/**
35 * Ugly workaround to unify data handlers on incoming and outgoing channels.
36 */
37struct CadetTestChannelWrapper
38{
39 /**
40 * Channel pointer.
41 */
42 struct GNUNET_CADET_Channel *ch;
43};
44
45/**
46 * How many messages to send by default.
47 */
48#define TOTAL_PACKETS_DEFAULT 500
49
50/**
51 * How long until we give up on connecting the peers?
52 */
53#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
54
55/**
56 * Time to wait by default for stuff that should be rather fast.
57 */
58#define SHORT_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20)
59
60/**
61 * How fast do we send messages?
62 */
63#define SEND_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 10)
64
65
66/**
67 * How many packets to send.
68 */
69static unsigned int total_packets = TOTAL_PACKETS_DEFAULT;
70
71/**
72 * Time to wait for fast operations.
73 */
74static struct GNUNET_TIME_Relative short_time;
75
76/**
77 * Size of each test packet's payload
78 */
79static size_t size_payload = sizeof (uint32_t);
80
81/**
82 * Operation to get peer ids.
83 */
84static struct GNUNET_TESTBED_Operation *t_op[2];
85
86/**
87 * Peer ids.
88 */
89static struct GNUNET_PeerIdentity *p_id[2];
90
91/**
92 * Port ID
93 */
94static struct GNUNET_HashCode port;
95
96/**
97 * Peer ids counter.
98 */
99static unsigned int p_ids;
100
101/**
102 * Is the setup initialized?
103 */
104static int initialized;
105
106/**
107 * Number of payload packes sent.
108 */
109static int data_sent;
110
111/**
112 * Number of payload packets received.
113 */
114static int data_received;
115
116/**
117 * Number of payload packed acknowledgements sent.
118 */
119static int ack_sent;
120
121/**
122 * Number of payload packed explicitly (app level) acknowledged.
123 */
124static int ack_received;
125
126/**
127 * Total number of peers asked to run.
128 */
129static unsigned int peers_requested = 2;
130
131/**
132 * Number of currently running peers (should be same as @c peers_requested).
133 */
134static unsigned int peers_running;
135
136/**
137 * Test context (to shut down).
138 */
139struct GNUNET_CADET_TEST_Context *test_ctx;
140
141/**
142 * Task called to disconnect peers.
143 */
144static struct GNUNET_SCHEDULER_Task *disconnect_task;
145
146/**
147 * Task To perform tests
148 */
149static struct GNUNET_SCHEDULER_Task *test_task;
150
151/**
152 * Task runnining #send_next_msg().
153 */
154static struct GNUNET_SCHEDULER_Task *send_next_msg_task;
155
156/**
157 * Cadet handle for the root peer
158 */
159static struct GNUNET_CADET_Handle *h1;
160
161/**
162 * Cadet handle for the first leaf peer
163 */
164static struct GNUNET_CADET_Handle *h2;
165
166/**
167 * Channel handle for the root peer
168 */
169static struct GNUNET_CADET_Channel *outgoing_ch;
170
171/**
172 * Channel handle for the dest peer
173 */
174static struct GNUNET_CADET_Channel *incoming_ch;
175
176/**
177 * Time we started the data transmission (after channel has been established
178 * and initilized).
179 */
180static struct GNUNET_TIME_Absolute start_time;
181
182/**
183 * Peers handle.
184 */
185static struct GNUNET_TESTBED_Peer **testbed_peers;
186
187/**
188 * Statistics operation handle.
189 */
190static struct GNUNET_TESTBED_Operation *stats_op;
191
192/**
193 * Keepalives sent.
194 */
195static unsigned int ka_sent;
196
197/**
198 * Keepalives received.
199 */
200static unsigned int ka_received;
201
202/**
203 * How many messages were dropped by CADET because of full buffers?
204 */
205static unsigned int msg_dropped;
206
207
208/**
209 * Show the results of the test (banwidth acheived) and log them to GAUGER
210 */
211static void
212show_end_data (void)
213{
214 static struct GNUNET_TIME_Absolute end_time;
215 static struct GNUNET_TIME_Relative total_time;
216
217 end_time = GNUNET_TIME_absolute_get ();
218 total_time = GNUNET_TIME_absolute_get_difference (start_time, end_time);
219 FPRINTF (stderr,
220 "\nResults of test \"%s\"\n",
221 test_name);
222 FPRINTF (stderr,
223 "Test time %s\n",
224 GNUNET_STRINGS_relative_time_to_string (total_time, GNUNET_YES));
225 FPRINTF (stderr,
226 "Test bandwidth: %f kb/s\n",
227 4 * total_packets * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms
228 FPRINTF (stderr,
229 "Test throughput: %f packets/s\n\n",
230 total_packets * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms
231 GAUGER ("CADET",
232 test_name,
233 total_packets * 1000.0 / (total_time.rel_value_us / 1000),
234 "packets/s");
235}
236
237
238/**
239 * Shut down peergroup, clean up.
240 *
241 * @param cls Closure (unused).
242 * @param tc Task Context.
243 */
244static void
245shutdown_task (void *cls)
246{
247 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
248 "Ending test.\n");
249 if (NULL != send_next_msg_task)
250 {
251 GNUNET_SCHEDULER_cancel (send_next_msg_task);
252 send_next_msg_task = NULL;
253 }
254 if (NULL != test_task)
255 {
256 GNUNET_SCHEDULER_cancel (test_task);
257 test_task = NULL;
258 }
259 for (unsigned int i = 0; i < 2; i++)
260 GNUNET_TESTBED_operation_done (t_op[i]);
261 if (NULL != outgoing_ch)
262 {
263 GNUNET_CADET_channel_destroy (outgoing_ch);
264 outgoing_ch = NULL;
265 }
266 if (NULL != incoming_ch)
267 {
268 GNUNET_CADET_channel_destroy (incoming_ch);
269 incoming_ch = NULL;
270 }
271 GNUNET_CADET_TEST_cleanup (test_ctx);
272}
273
274
275/**
276 * Stats callback. Finish the stats testbed operation and when all stats have
277 * been iterated, shutdown the test.
278 *
279 * @param cls Closure (line number from which termination was requested).
280 * @param op the operation that has been finished
281 * @param emsg error message in case the operation has failed; will be NULL if
282 * operation has executed successfully.
283 */
284static void
285stats_cont (void *cls,
286 struct GNUNET_TESTBED_Operation *op,
287 const char *emsg)
288{
289 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
290 "KA sent: %u, KA received: %u\n",
291 ka_sent,
292 ka_received);
293 if ((KEEPALIVE == test) && ((ka_sent < 2) || (ka_sent > ka_received + 1)))
294 {
295 GNUNET_break (0);
296 ok--;
297 }
298 GNUNET_TESTBED_operation_done (stats_op);
299
300 if (NULL != disconnect_task)
301 GNUNET_SCHEDULER_cancel (disconnect_task);
302 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
303 cls);
304}
305
306
307/**
308 * Process statistic values.
309 *
310 * @param cls closure (line number, unused)
311 * @param peer the peer the statistic belong to
312 * @param subsystem name of subsystem that created the statistic
313 * @param name the name of the datum
314 * @param value the current value
315 * @param is_persistent #GNUNET_YES if the value is persistent, #GNUNET_NO if not
316 * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
317 */
318static int
319stats_iterator (void *cls,
320 const struct GNUNET_TESTBED_Peer *peer,
321 const char *subsystem,
322 const char *name,
323 uint64_t value,
324 int is_persistent)
325{
326 static const char *s_sent = "# keepalives sent";
327 static const char *s_recv = "# keepalives received";
328 static const char *rdrops = "# messages dropped due to full buffer";
329 static const char *cdrops = "# messages dropped due to slow client";
330 uint32_t i;
331
332 i = GNUNET_TESTBED_get_index (peer);
333 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "STATS PEER %u - %s [%s]: %llu\n", i,
334 subsystem, name, (unsigned long long) value);
335 if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i)
336 ka_sent = value;
337 if (0 == strncmp (s_recv, name, strlen (s_recv)) && peers_requested - 1 == i)
338 ka_received = value;
339 if (0 == strncmp (rdrops, name, strlen (rdrops)))
340 msg_dropped += value;
341 if (0 == strncmp (cdrops, name, strlen (cdrops)))
342 msg_dropped += value;
343
344 return GNUNET_OK;
345}
346
347
348/**
349 * Task to gather all statistics.
350 *
351 * @param cls Closure (line from which the task was scheduled).
352 */
353static void
354gather_stats_and_exit (void *cls)
355{
356 long l = (long) cls;
357
358 disconnect_task = NULL;
359 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
360 "gathering statistics from line %ld\n",
361 l);
362 if (NULL != outgoing_ch)
363 {
364 GNUNET_CADET_channel_destroy (outgoing_ch);
365 outgoing_ch = NULL;
366 }
367 stats_op = GNUNET_TESTBED_get_statistics (peers_running,
368 testbed_peers,
369 "cadet",
370 NULL,
371 &stats_iterator,
372 stats_cont,
373 cls);
374}
375
376
377/**
378 * Abort test: schedule disconnect and shutdown immediately
379 *
380 * @param line Line in the code the abort is requested from (__LINE__).
381 */
382static void
383abort_test (long line)
384{
385 if (NULL != disconnect_task)
386 {
387 GNUNET_SCHEDULER_cancel (disconnect_task);
388 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
389 "Aborting test from %ld\n",
390 line);
391 disconnect_task =
392 GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
393 (void *) line);
394 }
395}
396
397
398/**
399 * Send a message on the channel with the appropriate size and payload.
400 *
401 * Update the appropriate *_sent counter.
402 *
403 * @param channel Channel to send the message on.
404 */
405static void
406send_test_message (struct GNUNET_CADET_Channel *channel)
407{
408 struct GNUNET_MQ_Envelope *env;
409 struct GNUNET_MessageHeader *msg;
410 uint32_t *data;
411 int payload;
412 int size;
413
414 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
415 "Sending test message on channel %p\n",
416 channel);
417 size = size_payload;
418 if (GNUNET_NO == initialized)
419 {
420 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending INITIALIZER\n");
421 size += 1000;
422 payload = data_sent;
423 if (SPEED_ACK == test) // FIXME unify SPEED_ACK with an initializer
424 data_sent++;
425 }
426 else if (SPEED == test || SPEED_ACK == test)
427 {
428 if (get_target_channel() == channel)
429 {
430 payload = ack_sent;
431 size += ack_sent;
432 ack_sent++;
433 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
434 "Sending ACK %u [%d bytes]\n",
435 payload, size);
436 }
437 else
438 {
439 payload = data_sent;
440 size += data_sent;
441 data_sent++;
442 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
443 "Sending DATA %u [%d bytes]\n",
444 data_sent, size);
445 }
446 }
447 else if (FORWARD == test)
448 {
449 payload = ack_sent;
450 }
451 else if (P2P_SIGNAL == test)
452 {
453 payload = data_sent;
454 }
455 else
456 {
457 GNUNET_assert (0);
458 }
459 env = GNUNET_MQ_msg_extra (msg, size, GNUNET_MESSAGE_TYPE_DUMMY);
460
461 data = (uint32_t *) &msg[1];
462 *data = htonl (payload);
463 GNUNET_MQ_send (GNUNET_CADET_get_mq (channel), env);
464}
465
466
467/**
468 * Task to request a new data transmission in a SPEED test, without waiting
469 * for previous messages to be sent/arrrive.
470 *
471 * @param cls Closure (unused).
472 */
473static void
474send_next_msg (void *cls)
475{
476 struct GNUNET_CADET_Channel *channel;
477
478 send_next_msg_task = NULL;
479 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
480 "Sending next message: %d\n",
481 data_sent);
482
483 channel = GNUNET_YES == test_backwards ? incoming_ch : outgoing_ch;
484 GNUNET_assert (NULL != channel);
485 GNUNET_assert (SPEED == test);
486 send_test_message (channel);
487 if (data_sent < total_packets)
488 {
489 /* SPEED test: Send all messages as soon as possible */
490 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
491 "Scheduling message %d\n",
492 data_sent + 1);
493 send_next_msg_task =
494 GNUNET_SCHEDULER_add_delayed (SEND_INTERVAL,
495 &send_next_msg,
496 NULL);
497 }
498}
499
500
501/**
502 * Check if payload is sane (size contains payload).
503 *
504 * @param cls should match #ch
505 * @param message The actual message.
506 * @return #GNUNET_OK to keep the channel open,
507 * #GNUNET_SYSERR to close it (signal serious error).
508 */
509static int
510check_data (void *cls,
511 const struct GNUNET_MessageHeader *message)
512{
513 return GNUNET_OK; /* all is well-formed */
514}
515
516
517/**
518 * Function is called whenever a message is received.
519 *
520 * @param cls closure (set from GNUNET_CADET_connect(), peer number)
521 * @param message the actual message
522 */
523static void
524handle_data (void *cls,
525 const struct GNUNET_MessageHeader *message)
526{
527 struct CadetTestChannelWrapper *ch = cls;
528 struct GNUNET_CADET_Channel *channel = ch->ch;
529 uint32_t *data;
530 uint32_t payload;
531 int *counter;
532
533 GNUNET_CADET_receive_done (channel);
534 counter = get_target_channel () == channel ? &data_received : &ack_received;
535 if (channel == outgoing_ch)
536 {
537 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
538 "Root client got a message.\n");
539 }
540 else if (channel == incoming_ch)
541 {
542 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
543 "Leaf client got a message.\n");
544 }
545 else
546 {
547 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
548 "Unknown channel %p.\n",
549 channel);
550 GNUNET_assert (0);
551 }
552
553 data = (uint32_t *) &message[1];
554 payload = ntohl (*data);
555 if (payload == *counter)
556 {
557 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
558 "Payload as expected: %u\n",
559 payload);
560 }
561 else
562 {
563 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
564 "Received payload %u, expected: %u\n",
565 payload, *counter);
566 }
567 (*counter)++;
568 if (get_target_channel () == channel) /* Got "data" */
569 {
570 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
571 " received data %u\n",
572 data_received);
573 if (data_received < total_packets)
574 return;
575 }
576 else /* Got "ack" */
577 {
578 if (SPEED_ACK == test || SPEED == test)
579 {
580 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", ack_received);
581 /* Send more data */
582 send_test_message (channel);
583 if (ack_received < total_packets && SPEED != test)
584 return;
585 if (ok == 2 && SPEED == test)
586 return;
587 show_end_data ();
588 }
589 if (test == P2P_SIGNAL)
590 {
591 GNUNET_CADET_channel_destroy (incoming_ch);
592 incoming_ch = NULL;
593 }
594 else
595 {
596 GNUNET_CADET_channel_destroy (outgoing_ch);
597 outgoing_ch = NULL;
598 }
599 }
600}
601
602
603/**
604 * Method called whenever a peer connects to a port in MQ-based CADET.
605 *
606 * @param cls Closure from #GNUNET_CADET_open_port (peer # as long).
607 * @param channel New handle to the channel.
608 * @param source Peer that started this channel.
609 * @return Closure for the incoming @a channel. It's given to:
610 * - The #GNUNET_CADET_DisconnectEventHandler (given to
611 * #GNUNET_CADET_open_port) when the channel dies.
612 * - Each the #GNUNET_MQ_MessageCallback handlers for each message
613 * received on the @a channel.
614 */
615static void *
616connect_handler (void *cls,
617 struct GNUNET_CADET_Channel *channel,
618 const struct GNUNET_PeerIdentity *source)
619{
620 struct CadetTestChannelWrapper *ch;
621 long peer = (long) cls;
622
623 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
624 "Incoming channel from %s to %ld: %p\n",
625 GNUNET_i2s (source),
626 peer,
627 channel);
628 if (peer == peers_requested - 1)
629 {
630 if (NULL != incoming_ch)
631 {
632 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
633 "Duplicate incoming channel for client %lu\n",
634 (long) cls);
635 GNUNET_assert (0);
636 }
637 incoming_ch = channel;
638 }
639 else
640 {
641 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
642 "Incoming channel for unexpected peer #%lu\n",
643 (long) cls);
644 GNUNET_assert (0);
645 }
646 ch = GNUNET_new (struct CadetTestChannelWrapper);
647 ch->ch = channel;
648
649 return ch;
650}
651
652
653/**
654 * Function called whenever an MQ-channel is destroyed, even if the destruction
655 * was requested by #GNUNET_CADET_channel_destroy.
656 * It must NOT call #GNUNET_CADET_channel_destroy on the channel.
657 *
658 * It should clean up any associated state, including cancelling any pending
659 * transmission on this channel.
660 *
661 * @param cls Channel closure (channel wrapper).
662 * @param channel Connection to the other end (henceforth invalid).
663 */
664static void
665disconnect_handler (void *cls,
666 const struct GNUNET_CADET_Channel *channel)
667{
668 struct CadetTestChannelWrapper *ch_w = cls;
669
670 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
671 "Channel disconnected at %d\n",
672 ok);
673 GNUNET_assert (ch_w->ch == channel);
674 if (channel == incoming_ch)
675 incoming_ch = NULL;
676 else if (outgoing_ch == channel)
677 outgoing_ch = NULL;
678 else
679 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
680 "Disconnect on unknown channel %p\n",
681 channel);
682 if (NULL != disconnect_task)
683 GNUNET_SCHEDULER_cancel (disconnect_task);
684 disconnect_task = GNUNET_SCHEDULER_add_now (&gather_stats_and_exit,
685 (void *) __LINE__);
686 GNUNET_free (ch_w);
687}
688
689
690/**
691 * Start the testcase, we know the peers and have handles to CADET.
692 *
693 * Testcase continues when the root receives confirmation of connected peers,
694 * on callback function ch.
695 *
696 * @param cls Closure (unused).
697 */
698static void
699start_test (void *cls)
700{
701 struct GNUNET_MQ_MessageHandler handlers[] = {
702 GNUNET_MQ_hd_var_size (data,
703 GNUNET_MESSAGE_TYPE_DUMMY,
704 struct GNUNET_MessageHeader,
705 NULL),
706 GNUNET_MQ_handler_end ()
707 };
708 struct CadetTestChannelWrapper *ch;
709 enum GNUNET_CADET_ChannelOption flags;
710
711 test_task = NULL;
712 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
713 "In start_test\n");
714 start_time = GNUNET_TIME_absolute_get ();
715 ch = GNUNET_new (struct CadetTestChannelWrapper);
716 outgoing_ch = GNUNET_CADET_channel_create (h1,
717 ch,
718 p_id[1],
719 &port,
720 flags,
721 NULL,
722 &disconnect_handler,
723 handlers);
724 ch->ch = outgoing_ch;
725 GNUNET_assert (NULL == disconnect_task);
726 disconnect_task
727 = GNUNET_SCHEDULER_add_delayed (short_time,
728 &gather_stats_and_exit,
729 (void *) __LINE__);
730 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
731 "Sending data initializer on channel %p...\n",
732 outgoing_ch);
733 send_test_message (outgoing_ch);
734}
735
736
737/**
738 * Callback to be called when the requested peer information is available
739 *
740 * @param cls the closure from GNUNET_TESTBED_peer_get_information()
741 * @param op the operation this callback corresponds to
742 * @param pinfo the result; will be NULL if the operation has failed
743 * @param emsg error message if the operation has failed;
744 * NULL if the operation is successfull
745 */
746static void
747pi_cb (void *cls,
748 struct GNUNET_TESTBED_Operation *op,
749 const struct GNUNET_TESTBED_PeerInformation *pinfo,
750 const char *emsg)
751{
752 long i = (long) cls;
753
754 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
755 "ID callback for %ld\n",
756 i);
757 if ( (NULL == pinfo) ||
758 (NULL != emsg) )
759 {
760 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
761 "pi_cb: %s\n",
762 emsg);
763 abort_test (__LINE__);
764 return;
765 }
766 p_id[i] = pinfo->result.id;
767 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
768 "id: %s\n",
769 GNUNET_i2s (p_id[i]));
770 p_ids++;
771 if (p_ids < 2)
772 return;
773 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
774 "Got all IDs, starting test\n");
775 test_task = GNUNET_SCHEDULER_add_now (&start_test,
776 NULL);
777}
778
779
780/**
781 * test main: start test when all peers are connected
782 *
783 * @param cls Closure.
784 * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
785 * @param num_peers Number of peers that are running.
786 * @param peers Array of peers.
787 * @param cadets Handle to each of the CADETs of the peers.
788 */
789static void
790tmain (void *cls,
791 struct GNUNET_CADET_TEST_Context *ctx,
792 unsigned int num_peers,
793 struct GNUNET_TESTBED_Peer **peers,
794 struct GNUNET_CADET_Handle **cadets)
795{
796 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
797 "test main\n");
798 test_ctx = ctx;
799 peers_running = num_peers;
800 GNUNET_assert (peers_running == peers_requested);
801 testbed_peers = peers;
802 h1 = cadets[0];
803 h2 = cadets[num_peers - 1];
804 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
805 NULL);
806 p_ids = 0;
807 t_op[0] = GNUNET_TESTBED_peer_get_information (peers[0],
808 GNUNET_TESTBED_PIT_IDENTITY,
809 &pi_cb,
810 (void *) 0L);
811 t_op[1] = GNUNET_TESTBED_peer_get_information (peers[num_peers - 1],
812 GNUNET_TESTBED_PIT_IDENTITY,
813 &pi_cb,
814 (void *) 1L);
815 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
816 "requested peer ids\n");
817}
818
819
820/**
821 * Main: start test
822 */
823int
824main (int argc,
825 char *argv[])
826{
827 static const struct GNUNET_HashCode *ports[2];
828 struct GNUNET_MQ_MessageHandler handlers[] = {
829 GNUNET_MQ_hd_var_size (data,
830 GNUNET_MESSAGE_TYPE_DUMMY,
831 struct GNUNET_MessageHeader,
832 NULL),
833 GNUNET_MQ_handler_end ()
834 };
835 const char *config_file = "test_cadet.conf";
836 char port_id[] = "test port";
837 struct GNUNET_GETOPT_CommandLineOption options[] = {
838 GNUNET_GETOPT_option_relative_time ('t',
839 "time",
840 "short_time",
841 gettext_noop ("set short timeout"),
842 &short_time),
843 GNUNET_GETOPT_option_uint ('m',
844 "messages",
845 "NUM_MESSAGES",
846 gettext_noop ("set number of messages to send"),
847 &total_packets),
848 GNUNET_GETOPT_option_uint ('p',
849 "peers",
850 "NUM_PEERS",
851 gettext_noop ("number of peers to launch"),
852 &peers_requested),
853 GNUNET_GETOPT_OPTION_END
854 };
855
856 GNUNET_log_setup ("test-cadet-flow",
857 "DEBUG",
858 NULL);
859 total_packets = TOTAL_PACKETS;
860 short_time = SHORT_TIME;
861 if (-1 == GNUNET_GETOPT_run (argv[0],
862 options,
863 argc,
864 argv))
865 {
866 FPRINTF (stderr,
867 "test failed: problem with CLI parameters\n");
868 return 1;
869 }
870 GNUNET_CRYPTO_hash (port_id,
871 sizeof (port_id),
872 &port);
873 ports[0] = &port;
874 ports[1] = NULL;
875 GNUNET_CADET_TEST_ruN ("test_cadet_flow",
876 config_file,
877 peers_requested,
878 &tmain,
879 NULL, /* tmain cls */
880 &connect_handler,
881 NULL,
882 &disconnect_handler,
883 handlers,
884 ports);
885 return 0;
886}
887
888/* end of test_cadet_flow.c */
diff --git a/src/cadet/test_cadet_local_mq.c b/src/cadet/test_cadet_local_mq.c
index 3089c7fbb..2ea754743 100644
--- a/src/cadet/test_cadet_local_mq.c
+++ b/src/cadet/test_cadet_local_mq.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file cadet/test_cadet_local.c 22 * @file cadet/test_cadet_local_mq.c
23 * @brief test cadet local: test of cadet channels with just one peer 23 * @brief test cadet local: test of cadet channels with just one peer
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 */ 25 */
@@ -123,7 +123,9 @@ do_shutdown (void *cls)
123static void 123static void
124do_abort (void *cls) 124do_abort (void *cls)
125{ 125{
126 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ABORT from line %ld\n", (long) cls); 126 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
127 "ABORT from line %ld\n",
128 (long) cls);
127 result = GNUNET_SYSERR; 129 result = GNUNET_SYSERR;
128 abort_task = NULL; 130 abort_task = NULL;
129 GNUNET_SCHEDULER_shutdown (); 131 GNUNET_SCHEDULER_shutdown ();
@@ -148,7 +150,8 @@ connected (void *cls,
148{ 150{
149 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 151 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
150 "connected %s, cls: %p\n", 152 "connected %s, cls: %p\n",
151 GNUNET_i2s(source), cls); 153 GNUNET_i2s(source),
154 cls);
152 return channel; 155 return channel;
153} 156}
154 157
@@ -206,7 +209,8 @@ handle_data_received (void *cls,
206static void 209static void
207message_sent (void *cls) 210message_sent (void *cls)
208{ 211{
209 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "message sent\n"); 212 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
213 "message sent\n");
210} 214}
211 215
212 216
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c
index 403deb38a..5341e7d61 100644
--- a/src/dht/gnunet_dht_profiler.c
+++ b/src/dht/gnunet_dht_profiler.c
@@ -45,7 +45,7 @@ static unsigned int put_probability = 100;
45/** 45/**
46 * Configuration 46 * Configuration
47 */ 47 */
48static struct GNUNET_CONFIGURATION_Handle *cfg; 48static const struct GNUNET_CONFIGURATION_Handle *cfg;
49 49
50/** 50/**
51 * Name of the file with the hosts to run the test over 51 * Name of the file with the hosts to run the test over
@@ -917,7 +917,7 @@ run (void *cls,
917 num_peers); 917 num_peers);
918 return; 918 return;
919 } 919 }
920 cfg = GNUNET_CONFIGURATION_dup (config); 920 cfg = config;
921 event_mask = 0; 921 event_mask = 0;
922 GNUNET_TESTBED_run (hosts_file, 922 GNUNET_TESTBED_run (hosts_file,
923 cfg, 923 cfg,
diff --git a/src/gns/gnunet-gns-benchmark.c b/src/gns/gnunet-gns-benchmark.c
index 00d1c6813..0ab6cefd5 100644
--- a/src/gns/gnunet-gns-benchmark.c
+++ b/src/gns/gnunet-gns-benchmark.c
@@ -216,6 +216,9 @@ process_result (void *cls,
216 (void) rd_count; 216 (void) rd_count;
217 (void) rd; 217 (void) rd;
218 active_cnt--; 218 active_cnt--;
219 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
220 "Got response for request `%s'\n",
221 req->hostname);
219 req->lr = NULL; 222 req->lr = NULL;
220 req->latency = GNUNET_TIME_absolute_get_duration (req->op_start_time); 223 req->latency = GNUNET_TIME_absolute_get_duration (req->op_start_time);
221 GNUNET_CONTAINER_DLL_remove (act_head, 224 GNUNET_CONTAINER_DLL_remove (act_head,