b5e42352e64ebfcbd2e3c951b4ed0d7e4ee4099f
[oweals/gnunet.git] / src / transport / test_transport_address_switch.c
1 /*
2  This file is part of GNUnet.
3  (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
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., 59 Temple Place - Suite 330,
18  Boston, MA 02111-1307, USA.
19  */
20 /**
21  * @file transport/test_transport_address_switch.c
22  * @brief base test case for transport implementations
23  *
24  * This test case tests if peers can successfully switch address when connected
25  * connected by monitoring statistic values
26  */
27 #include "platform.h"
28 #include "gnunet_transport_service.h"
29 #include "gnunet_ats_service.h"
30 #include "gauger.h"
31 #include "transport-testing.h"
32
33 /*
34  * Testcase specific declarations
35  */
36
37 GNUNET_NETWORK_STRUCT_BEGIN
38 struct TestMessage
39 {
40   struct GNUNET_MessageHeader header;
41   uint32_t num;
42 };
43 GNUNET_NETWORK_STRUCT_END
44
45 /**
46  * Message type for test messages
47  */
48 #define MTYPE 12345
49
50 /**
51  * Message size for test messages
52  */
53 #define MSIZE 2048
54
55 /**
56  * Testcase timeout
57  */
58 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
59
60 /**
61  * How long until we give up on transmitting the message?
62  */
63 #define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
64
65 #define DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
66 #define DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
67
68 /**
69  * Timeout task to send messages
70  */
71 static struct GNUNET_SCHEDULER_Task *die_task;
72
73
74 static struct GNUNET_SCHEDULER_Task *delayed_end_task;
75
76 /**
77  * Measurement task to send messages
78  */
79 static struct GNUNET_SCHEDULER_Task *measure_task;
80
81
82 struct PeerContext *p1;
83 char *cfg_file_p1;
84 struct GNUNET_STATISTICS_Handle *p1_stat;
85
86 struct PeerContext *p2;
87 char *cfg_file_p2;
88 struct GNUNET_STATISTICS_Handle *p2_stat;
89
90 struct PeerContext *sender;
91
92 struct PeerContext *receiver;
93
94 struct GNUNET_TRANSPORT_TransmitHandle *th;
95
96 struct GNUNET_TRANSPORT_TESTING_handle *tth;
97
98 static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
99
100 static int test_connected;
101
102 static int res;
103
104
105 /**
106  * Statistics about peer 1
107  */
108 static unsigned int p1_addresses_avail;
109 static unsigned int p1_switch_attempts;
110 static unsigned int p1_switch_success;
111 static unsigned int p1_switch_fail;
112
113
114 /**
115  * Statistics about peer 2
116  */
117 static unsigned int p2_switch_attempts;
118 static unsigned int p2_switch_success;
119 static unsigned int p2_switch_fail;
120 static unsigned int p2_addresses_avail;
121
122 /**
123  * Transmission statistics
124  */
125
126 /* Amount of data transfered since last switch attempt */
127 static unsigned long long bytes_sent_after_switch;
128 static unsigned long long bytes_recv_after_switch;
129
130 /*
131  * END Testcase specific declarations
132  */
133
134 #if VERBOSE
135 #define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
136 #else
137 #define OKPP do { ok++; } while (0)
138 #endif
139
140 static void end ();
141
142 static int
143 stat_start_attempt_cb (void *cls, const char *subsystem, const char *name,
144     uint64_t value, int is_persistent)
145 {
146   if (cls == p1)
147   {
148     p1_switch_attempts++;
149     FPRINTF (stderr, "(1:s)");
150   }
151   else if (cls == p2)
152   {
153     p2_switch_attempts++;
154     FPRINTF (stderr, "(2:s)");
155   }
156
157   bytes_recv_after_switch = 0;
158   bytes_sent_after_switch = 0;
159
160   return GNUNET_OK;
161 }
162
163
164 static int
165 stat_success_attempt_cb (void *cls, const char *subsystem, const char *name,
166     uint64_t value, int is_persistent)
167 {
168   if (cls == p1)
169   {
170     p1_switch_success++;
171     FPRINTF (stderr, "(1:+)");
172   }
173   if (cls == p2)
174   {
175     p2_switch_success++;
176     FPRINTF (stderr, "(2:+)");
177   }
178
179   return GNUNET_OK;
180 }
181
182
183 static int
184 stat_fail_attempt_cb (void *cls, const char *subsystem, const char *name,
185     uint64_t value, int is_persistent)
186 {
187   if (value == 0)
188     return GNUNET_OK;
189
190   if (cls == p1)
191   {
192     p1_switch_fail++;
193     FPRINTF (stderr, "(1:-)");
194   }
195   if (cls == p2)
196   {
197     p2_switch_fail++;
198     FPRINTF (stderr, "(2:-)");
199   }
200
201   return GNUNET_OK;
202 }
203
204 static int
205 stat_addresses_available (void *cls, const char *subsystem, const char *name,
206     uint64_t value, int is_persistent)
207 {
208   if (cls == p1)
209   {
210     p1_addresses_avail++;
211   }
212   if (cls == p2)
213   {
214     p2_addresses_avail++;
215   }
216
217   return GNUNET_OK;
218 }
219
220 static void
221 clean_up ()
222 {
223   if (measure_task != NULL )
224   {
225     GNUNET_SCHEDULER_cancel (measure_task);
226     measure_task = NULL;
227   }
228
229   if (delayed_end_task != NULL )
230   {
231     GNUNET_SCHEDULER_cancel (delayed_end_task);
232     delayed_end_task = NULL;
233   }
234
235   if (die_task != NULL )
236   {
237     GNUNET_SCHEDULER_cancel (die_task);
238     die_task = NULL;
239   }
240
241   if (NULL != p1_stat)
242   {
243     GNUNET_STATISTICS_watch_cancel (p1_stat, "transport",
244         "# Attempts to switch addresses",
245         stat_start_attempt_cb, p1);
246     GNUNET_STATISTICS_watch_cancel (p1_stat, "transport",
247         "# Successful attempts to switch addresses",
248         stat_success_attempt_cb, p1);
249     GNUNET_STATISTICS_watch_cancel (p1_stat, "transport",
250         "# Failed attempts to switch addresses (failed to send CONNECT CONT)",
251         stat_fail_attempt_cb, p1);
252     GNUNET_STATISTICS_watch_cancel (p1_stat, "transport",
253         "# Failed attempts to switch addresses (failed to send CONNECT)",
254         stat_fail_attempt_cb, p1);
255     GNUNET_STATISTICS_watch_cancel (p1_stat, "transport",
256         "# Failed attempts to switch addresses (no response)",
257         stat_fail_attempt_cb, p1);
258     GNUNET_STATISTICS_watch (p1_stat, "transport",
259         "# transport addresses",
260         stat_addresses_available, p1);
261     GNUNET_STATISTICS_destroy (p1_stat, GNUNET_NO);
262     p1_stat = NULL;
263   }
264   if (NULL != p2_stat)
265   {
266     GNUNET_STATISTICS_watch_cancel (p2_stat, "transport",
267         "# Attempts to switch addresses", stat_start_attempt_cb, p2);
268     GNUNET_STATISTICS_watch_cancel (p2_stat, "transport",
269         "# Successful attempts to switch addresses", stat_success_attempt_cb, p2);
270     GNUNET_STATISTICS_watch_cancel (p2_stat, "transport",
271         "# Failed attempts to switch addresses (failed to send CONNECT CONT)",
272         stat_fail_attempt_cb, p2);
273     GNUNET_STATISTICS_watch_cancel (p2_stat, "transport",
274         "# Failed attempts to switch addresses (failed to send CONNECT)",
275         stat_fail_attempt_cb, p2);
276     GNUNET_STATISTICS_watch_cancel (p2_stat, "transport",
277         "# Failed attempts to switch addresses (no response)",
278         stat_fail_attempt_cb, p2);
279     GNUNET_STATISTICS_watch (p2_stat, "transport",
280         "# transport addresses",
281         stat_addresses_available, p2);
282     GNUNET_STATISTICS_destroy (p2_stat, GNUNET_NO);
283     p2_stat = NULL;
284   }
285
286   if (th != NULL )
287   {
288     GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
289     th = NULL;
290   }
291   if (cc != NULL )
292   {
293     GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc);
294     cc = NULL;
295   }
296   if (p1 != NULL )
297   {
298     GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
299     p1 = NULL;
300   }
301   if (p2 != NULL )
302   {
303     GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
304     p2 = NULL;
305   }
306
307 }
308
309
310 static void
311 end ()
312 {
313   int result = 0;
314   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
315
316   delayed_end_task = NULL;
317   FPRINTF (stderr, "\n");
318   if (p1_switch_attempts > 0)
319   {
320     FPRINTF (stderr, "Peer 1 tried %u times to switch and succeeded %u times, failed %u times\n",
321         p1_switch_attempts, p1_switch_success, p1_switch_fail);
322     if (p1_switch_success != p1_switch_attempts)
323     {
324       GNUNET_break (0);
325       result ++;
326     }
327   }
328   else if (p1_addresses_avail > 1)
329   {
330     FPRINTF (stderr, "Peer 1 had %u addresses available, but did not try to switch\n",
331         p1_addresses_avail);
332   }
333   if (p2_switch_attempts > 0)
334   {
335     FPRINTF (stderr, "Peer 2 tried %u times to switch and succeeded %u times, failed %u times\n",
336         p2_switch_attempts, p2_switch_success, p2_switch_fail);
337     if (p2_switch_success != p2_switch_attempts)
338     {
339       GNUNET_break (0);
340       result ++;
341     }
342   }
343   else if (p2_addresses_avail > 1)
344   {
345     FPRINTF (stderr, "Peer 2 had %u addresses available, but did not try to switch\n",
346         p2_addresses_avail);
347   }
348
349   if ( ((p1_switch_attempts > 0) || (p2_switch_attempts > 0)) &&
350        (bytes_sent_after_switch == 0) )
351   {
352     FPRINTF (stderr, "No data sent after switching!\n");
353     GNUNET_break (0);
354     res ++;
355   }
356   if ( ((p1_switch_attempts > 0) || (p2_switch_attempts > 0)) &&
357        (bytes_recv_after_switch == 0) )
358   {
359     FPRINTF (stderr, "No data received after switching!\n");
360     GNUNET_break (0);
361     res ++;
362   }
363
364   clean_up();
365
366   res = result;
367 }
368
369
370 static void
371 end_badly ()
372 {
373   die_task = NULL;
374   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");
375
376   if (test_connected == GNUNET_YES)
377     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Peers got connected\n");
378   else
379     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Peers got NOT connected\n");
380
381   clean_up();
382
383   res = GNUNET_YES;
384 }
385
386
387 static void
388 notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
389     const struct GNUNET_MessageHeader *message)
390 {
391   const struct TestMessage *hdr;
392
393   hdr = (const struct TestMessage *) message;
394   if (MTYPE != ntohs (message->type))
395     return;
396
397   struct PeerContext *p = cls;
398   char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
399
400   GNUNET_log(GNUNET_ERROR_TYPE_INFO,
401       "Peer %u (`%s') got message %u of size %u from peer (`%s')\n", p->no, ps,
402       ntohl (hdr->num), ntohs (message->size), GNUNET_i2s (peer));
403
404   if ( ((p1_switch_attempts >= 1) || (p2_switch_attempts >= 1)) &&
405         (p1_switch_attempts == p1_switch_fail + p1_switch_success) &&
406         (p2_switch_attempts == p2_switch_fail + p2_switch_success) )
407   {
408       bytes_recv_after_switch += ntohs(hdr->header.size);
409       if ((bytes_sent_after_switch > 0) && (bytes_recv_after_switch > 0))
410       {
411         /* A peer switched addresses and sent and received data after the
412          * switch operations */
413         end ();
414       }
415   }
416
417
418   GNUNET_free(ps);
419 }
420
421
422 static size_t
423 notify_ready (void *cls, size_t size, void *buf)
424 {
425   char *cbuf = buf;
426   struct TestMessage hdr;
427   unsigned int ret;
428
429   th = NULL;
430   if (buf == NULL )
431   {
432     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
433         "Timeout occurred while waiting for transmit_ready for message\n");
434     if (NULL != die_task)
435       GNUNET_SCHEDULER_cancel (die_task);
436     die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL );
437     res = 1;
438     return 0;
439   }
440
441   GNUNET_assert(size >= MSIZE);
442   GNUNET_assert(buf != NULL);
443   cbuf = buf;
444
445   hdr.header.size = htons (MSIZE);
446   hdr.header.type = htons (MTYPE);
447   hdr.num = htonl (0);
448   memcpy (&cbuf[0], &hdr, sizeof(struct TestMessage));
449   ret += sizeof(struct TestMessage);
450   memset (&cbuf[sizeof(struct TestMessage)], '0', MSIZE - sizeof(struct TestMessage));
451   ret = MSIZE;
452
453 #if VERBOSE
454   char *receiver_s = GNUNET_strdup (GNUNET_i2s (&receiver->id));
455   GNUNET_log(GNUNET_ERROR_TYPE_INFO,
456       "Sending message %u of size %u from peer %u (`%4s') -> peer %u (`%s') !\n",
457       n, s, sender->no, GNUNET_i2s (&sender->id), receiver->no, receiver_s);
458   GNUNET_free(receiver_s);
459 #endif
460
461   if (th == NULL )
462     th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, MSIZE,
463         TIMEOUT_TRANSMIT, &notify_ready, NULL );
464
465   if ( ((p1_switch_attempts >= 1) || (p2_switch_attempts >= 1)) &&
466         (p1_switch_attempts == p1_switch_fail + p1_switch_success) &&
467         (p2_switch_attempts == p2_switch_fail + p2_switch_success) )
468   {
469     bytes_sent_after_switch += ret;
470   }
471
472   return ret;
473 }
474
475
476 static void
477 notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
478 {
479   struct PeerContext *p = cls;
480   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%4s') connected to us!\n",
481       p->no, GNUNET_i2s (peer));
482 }
483
484
485 static void
486 notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
487 {
488   struct PeerContext *p = cls;
489   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%4s') disconnected!\n", p->no,
490       GNUNET_i2s (peer));
491   if (th != NULL )
492     GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
493   th = NULL;
494
495 }
496
497
498 static void
499 sendtask ()
500 {
501   th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, MSIZE,
502       TIMEOUT_TRANSMIT, &notify_ready, NULL );
503 }
504
505
506 static void
507 progress_indicator (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
508 {
509   static int counter;
510   measure_task = NULL;
511   counter++;
512   if ((DURATION.rel_value_us / 1000 / 1000LL) < counter)
513   {
514     FPRINTF (stderr, "%s", ".\n");
515   }
516   else
517   {
518     FPRINTF (stderr, "%s", ".");
519     measure_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
520         &progress_indicator, NULL );
521   }
522 }
523
524
525 static void
526 testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
527 {
528   char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
529
530   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Peers connected: %u (%s) <-> %u (%s)\n",
531       p1->no, p1_c, p2->no, GNUNET_i2s (&p2->id));
532   GNUNET_free(p1_c);
533
534   cc = NULL;
535   test_connected = GNUNET_YES;
536
537   FPRINTF (stderr, "(i:s/+/-) \t i == peer 1/2, s/+/- : switch attempt/switch ok/switch fail\n");
538
539   measure_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
540       &progress_indicator, NULL );
541  GNUNET_SCHEDULER_add_now (&sendtask, NULL );
542 }
543
544
545 static void
546 start_cb (struct PeerContext *p, void *cls)
547 {
548   static int started;
549   started++;
550
551   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%s') started\n", p->no,
552       GNUNET_i2s (&p->id));
553   if (started != 2)
554     return;
555
556   test_connected = GNUNET_NO;
557   sender = p2;
558   receiver = p1;
559
560   char *sender_c = GNUNET_strdup (GNUNET_i2s (&sender->id));
561   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
562       "Test tries to send from %u (%s) -> peer %u (%s)\n", sender->no, sender_c,
563       receiver->no, GNUNET_i2s (&receiver->id));
564   GNUNET_free(sender_c);
565   cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb,
566       NULL );
567 }
568
569
570 static void
571 run (void *cls, char * const *args, const char *cfgfile,
572     const struct GNUNET_CONFIGURATION_Handle *cfg)
573 {
574   die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL );
575
576   p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth, cfg_file_p1, 1,
577       &notify_receive, &notify_connect, &notify_disconnect, &start_cb, NULL );
578
579   p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth, cfg_file_p2, 2,
580       &notify_receive, &notify_connect, &notify_disconnect, &start_cb, NULL );
581
582   if ((p1 == NULL )|| (p2 == NULL))
583   {
584     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n");
585     if (die_task != NULL)
586     GNUNET_SCHEDULER_cancel (die_task);
587     die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
588     return;
589   }
590
591   /* Start to watch statistics for peer 1 */
592   p1_stat = GNUNET_STATISTICS_create ("transport", p1->cfg);
593   GNUNET_STATISTICS_watch (p1_stat, "transport",
594       "# Attempts to switch addresses",
595       stat_start_attempt_cb, p1);
596   GNUNET_STATISTICS_watch (p1_stat, "transport",
597       "# Successful attempts to switch addresses",
598       stat_success_attempt_cb, p1);
599   GNUNET_STATISTICS_watch (p1_stat, "transport",
600       "# Failed attempts to switch addresses (failed to send CONNECT CONT)",
601       stat_fail_attempt_cb, p1);
602   GNUNET_STATISTICS_watch (p1_stat, "transport",
603       "# Failed attempts to switch addresses (failed to send CONNECT)",
604       stat_fail_attempt_cb, p1);
605   GNUNET_STATISTICS_watch (p1_stat, "transport",
606       "# Failed attempts to switch addresses (no response)",
607       stat_fail_attempt_cb, p1);
608   GNUNET_STATISTICS_watch (p1_stat, "transport",
609       "# transport addresses",
610       stat_addresses_available, p1);
611
612   /* Start to watch statistics for peer 2  */
613   p2_stat = GNUNET_STATISTICS_create ("transport", p2->cfg);
614   GNUNET_STATISTICS_watch (p2_stat, "transport",
615       "# Attempts to switch addresses",
616       stat_start_attempt_cb, p2);
617   GNUNET_STATISTICS_watch (p2_stat, "transport",
618       "# Successful attempts to switch addresses",
619       stat_success_attempt_cb, p2);
620   GNUNET_STATISTICS_watch (p2_stat, "transport",
621       "# Failed attempts to switch addresses (failed to send CONNECT CONT)",
622       stat_fail_attempt_cb, p2);
623   GNUNET_STATISTICS_watch (p2_stat, "transport",
624       "# Failed attempts to switch addresses (failed to send CONNECT)",
625       stat_fail_attempt_cb, p2);
626   GNUNET_STATISTICS_watch (p2_stat, "transport",
627       "# Failed attempts to switch addresses (no response)",
628       stat_fail_attempt_cb, p2);
629   GNUNET_STATISTICS_watch (p2_stat, "transport",
630       "# transport addresses",
631       stat_addresses_available, p2);
632
633   if ((p1_stat == NULL )|| (p2_stat == NULL))
634   {
635     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not create statistics for peers!\n");
636     if (die_task != NULL)
637     GNUNET_SCHEDULER_cancel (die_task);
638     die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
639     return;
640   }
641 }
642
643 int
644 main (int argc, char *argv[])
645 {
646   char *test_plugin;
647   char *test_source;
648   char *test_name;
649
650   static char *argv_new[] = { "test-transport-address-switch", "-c",
651       "test_transport_startonly.conf", NULL };
652
653   static struct GNUNET_GETOPT_CommandLineOption options[] = {
654       GNUNET_GETOPT_OPTION_END };
655
656   GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name);
657
658   GNUNET_log_setup (test_name, "WARNING", NULL );
659
660   GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source);
661   GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv[0], test_source,
662       &test_plugin);
663
664   tth = GNUNET_TRANSPORT_TESTING_init ();
665
666   GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1);
667   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Using cfg [%u] : %s \n", 1, cfg_file_p1);
668   GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p2, 2);
669   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Using cfg [%u] : %s \n", 2, cfg_file_p2);
670
671   GNUNET_PROGRAM_run ((sizeof(argv_new) / sizeof(char *)) - 1, argv_new,
672       test_name, "nohelp", options, &run, NULL );
673
674   GNUNET_free(cfg_file_p1);
675   GNUNET_free(cfg_file_p2);
676
677   GNUNET_free(test_source);
678   GNUNET_free(test_plugin);
679   GNUNET_free(test_name);
680
681   GNUNET_TRANSPORT_TESTING_done (tth);
682
683   return res;
684 }
685
686 /* end of test_transport_address_switch.c */