aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/test_cadet.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-25 20:06:39 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-25 20:06:39 +0100
commitee8ad193a3185d258d4016e1f858cedbf37134ba (patch)
tree9854c3084c2dc95654bdf86091259d54b6d5a779 /src/cadet/test_cadet.c
parent602249cc05e5817019e6cf9802dc00ec8fd1e7ce (diff)
downloadgnunet-ee8ad193a3185d258d4016e1f858cedbf37134ba.tar.gz
gnunet-ee8ad193a3185d258d4016e1f858cedbf37134ba.zip
cleanups
Diffstat (limited to 'src/cadet/test_cadet.c')
-rw-r--r--src/cadet/test_cadet.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c
index 3a1042eba..df279d72a 100644
--- a/src/cadet/test_cadet.c
+++ b/src/cadet/test_cadet.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2011 GNUnet e.V. 3 Copyright (C) 2011, 2017 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -64,7 +64,7 @@ static int test;
64/** 64/**
65 * String with test name 65 * String with test name
66 */ 66 */
67char *test_name; 67static char *test_name;
68 68
69/** 69/**
70 * Flag to send traffic leaf->root in speed tests to test BCK_ACK logic. 70 * Flag to send traffic leaf->root in speed tests to test BCK_ACK logic.
@@ -79,32 +79,32 @@ static int ok;
79/** 79/**
80 * Number of events expected to conclude the test successfully. 80 * Number of events expected to conclude the test successfully.
81 */ 81 */
82int ok_goal; 82static int ok_goal;
83 83
84/** 84/**
85 * Size of each test packet 85 * Size of each test packet
86 */ 86 */
87size_t size_payload = sizeof (struct GNUNET_MessageHeader) + sizeof (uint32_t); 87static size_t size_payload = sizeof (struct GNUNET_MessageHeader) + sizeof (uint32_t);
88 88
89/** 89/**
90 * Operation to get peer ids. 90 * Operation to get peer ids.
91 */ 91 */
92struct GNUNET_TESTBED_Operation *t_op[2]; 92static struct GNUNET_TESTBED_Operation *t_op[2];
93 93
94/** 94/**
95 * Peer ids. 95 * Peer ids.
96 */ 96 */
97struct GNUNET_PeerIdentity *p_id[2]; 97static struct GNUNET_PeerIdentity *p_id[2];
98 98
99/** 99/**
100 * Port ID 100 * Port ID
101 */ 101 */
102struct GNUNET_HashCode port; 102static struct GNUNET_HashCode port;
103 103
104/** 104/**
105 * Peer ids counter. 105 * Peer ids counter.
106 */ 106 */
107unsigned int p_ids; 107static unsigned int p_ids;
108 108
109/** 109/**
110 * Is the setup initialized? 110 * Is the setup initialized?
@@ -347,9 +347,12 @@ shutdown_task (void *cls)
347static void 347static void
348stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) 348stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
349{ 349{
350 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " KA sent: %u, KA received: %u\n", 350 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
351 " KA sent: %u, KA received: %u\n",
351 ka_sent, ka_received); 352 ka_sent, ka_received);
352 if (KEEPALIVE == test && (ka_sent < 2 || ka_sent > ka_received + 1)) 353 if ( (KEEPALIVE == test) &&
354 ( (ka_sent < 2) ||
355 (ka_sent > ka_received + 1)) )
353 ok--; 356 ok--;
354 GNUNET_TESTBED_operation_done (stats_op); 357 GNUNET_TESTBED_operation_done (stats_op);
355 358
@@ -439,10 +442,11 @@ gather_stats_and_exit (void *cls)
439static void 442static void
440abort_test (long line) 443abort_test (long line)
441{ 444{
442 if (disconnect_task != NULL) 445 if (NULL != disconnect_task)
443 { 446 {
444 GNUNET_SCHEDULER_cancel (disconnect_task); 447 GNUNET_SCHEDULER_cancel (disconnect_task);
445 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting test from %ld\n", line); 448 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
449 "Aborting test from %ld\n", line);
446 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, 450 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
447 (void *) line); 451 (void *) line);
448 } 452 }