diff options
Diffstat (limited to 'src/testbed/test_testbed_underlay.c')
-rw-r--r-- | src/testbed/test_testbed_underlay.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/src/testbed/test_testbed_underlay.c b/src/testbed/test_testbed_underlay.c index 41aa43ce5..fad4282d7 100644 --- a/src/testbed/test_testbed_underlay.c +++ b/src/testbed/test_testbed_underlay.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -49,10 +49,10 @@ static struct GNUNET_TESTBED_Operation *op; | |||
49 | * @param tc scheduler task context | 49 | * @param tc scheduler task context |
50 | */ | 50 | */ |
51 | static void | 51 | static void |
52 | do_shutdown (void *cls) | 52 | do_shutdown(void *cls) |
53 | { | 53 | { |
54 | if (NULL != op) | 54 | if (NULL != op) |
55 | GNUNET_TESTBED_operation_done (op); | 55 | GNUNET_TESTBED_operation_done(op); |
56 | op = NULL; | 56 | op = NULL; |
57 | } | 57 | } |
58 | 58 | ||
@@ -66,21 +66,21 @@ do_shutdown (void *cls) | |||
66 | * operation has executed successfully. | 66 | * operation has executed successfully. |
67 | */ | 67 | */ |
68 | static void | 68 | static void |
69 | overlay_connect_status (void *cls, | 69 | overlay_connect_status(void *cls, |
70 | struct GNUNET_TESTBED_Operation *op_, | 70 | struct GNUNET_TESTBED_Operation *op_, |
71 | const char *emsg) | 71 | const char *emsg) |
72 | { | 72 | { |
73 | GNUNET_assert (op_ == op); | 73 | GNUNET_assert(op_ == op); |
74 | GNUNET_TESTBED_operation_done (op); | 74 | GNUNET_TESTBED_operation_done(op); |
75 | op = NULL; | 75 | op = NULL; |
76 | if (NULL == emsg) | 76 | if (NULL == emsg) |
77 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Peers 0 and 2 should not get connected\n"); | 77 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Peers 0 and 2 should not get connected\n"); |
78 | else | 78 | else |
79 | { | 79 | { |
80 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers 0 and 2 not connected: %s. Success!\n", emsg); | 80 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Peers 0 and 2 not connected: %s. Success!\n", emsg); |
81 | result = GNUNET_OK; | 81 | result = GNUNET_OK; |
82 | } | 82 | } |
83 | GNUNET_SCHEDULER_shutdown (); | 83 | GNUNET_SCHEDULER_shutdown(); |
84 | } | 84 | } |
85 | 85 | ||
86 | 86 | ||
@@ -98,29 +98,29 @@ overlay_connect_status (void *cls, | |||
98 | * failed | 98 | * failed |
99 | */ | 99 | */ |
100 | static void | 100 | static void |
101 | test_master (void *cls, | 101 | test_master(void *cls, |
102 | struct GNUNET_TESTBED_RunHandle *h, | 102 | struct GNUNET_TESTBED_RunHandle *h, |
103 | unsigned int num_peers, | 103 | unsigned int num_peers, |
104 | struct GNUNET_TESTBED_Peer **peers_, | 104 | struct GNUNET_TESTBED_Peer **peers_, |
105 | unsigned int links_succeeded, | 105 | unsigned int links_succeeded, |
106 | unsigned int links_failed) | 106 | unsigned int links_failed) |
107 | { | 107 | { |
108 | GNUNET_assert (NULL == cls); | 108 | GNUNET_assert(NULL == cls); |
109 | if (NULL == peers_) | 109 | if (NULL == peers_) |
110 | { | 110 | { |
111 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failing test due to timeout\n"); | 111 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failing test due to timeout\n"); |
112 | GNUNET_SCHEDULER_shutdown (); | 112 | GNUNET_SCHEDULER_shutdown(); |
113 | return; | 113 | return; |
114 | } | 114 | } |
115 | GNUNET_assert (NUM_PEERS == num_peers); | 115 | GNUNET_assert(NUM_PEERS == num_peers); |
116 | op = GNUNET_TESTBED_overlay_connect (NULL, | 116 | op = GNUNET_TESTBED_overlay_connect(NULL, |
117 | &overlay_connect_status, | 117 | &overlay_connect_status, |
118 | NULL, | 118 | NULL, |
119 | peers_[0], | 119 | peers_[0], |
120 | peers_[2]); | 120 | peers_[2]); |
121 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | 121 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, |
122 | 60), | 122 | 60), |
123 | &do_shutdown, NULL); | 123 | &do_shutdown, NULL); |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
@@ -136,7 +136,7 @@ test_master (void *cls, | |||
136 | * Main function | 136 | * Main function |
137 | */ | 137 | */ |
138 | int | 138 | int |
139 | main (int argc, char **argv) | 139 | main(int argc, char **argv) |
140 | { | 140 | { |
141 | struct GNUNET_CONFIGURATION_Handle *cfg; | 141 | struct GNUNET_CONFIGURATION_Handle *cfg; |
142 | char pwd[PATH_MAX]; | 142 | char pwd[PATH_MAX]; |
@@ -145,26 +145,26 @@ main (int argc, char **argv) | |||
145 | 145 | ||
146 | result = GNUNET_SYSERR; | 146 | result = GNUNET_SYSERR; |
147 | event_mask = 0; | 147 | event_mask = 0; |
148 | cfg = GNUNET_CONFIGURATION_create (); | 148 | cfg = GNUNET_CONFIGURATION_create(); |
149 | GNUNET_assert (GNUNET_YES == | 149 | GNUNET_assert(GNUNET_YES == |
150 | GNUNET_CONFIGURATION_parse (cfg, | 150 | GNUNET_CONFIGURATION_parse(cfg, |
151 | "test_testbed_underlay.conf.in")); | 151 | "test_testbed_underlay.conf.in")); |
152 | if (NULL == getcwd (pwd, PATH_MAX)) | 152 | if (NULL == getcwd(pwd, PATH_MAX)) |
153 | return 1; | 153 | return 1; |
154 | GNUNET_assert (0 < GNUNET_asprintf (&dbfile, "%s/%s", pwd, | 154 | GNUNET_assert(0 < GNUNET_asprintf(&dbfile, "%s/%s", pwd, |
155 | "test-underlay.sqlite")); | 155 | "test-underlay.sqlite")); |
156 | GNUNET_CONFIGURATION_set_value_string (cfg, "TESTBED-UNDERLAY","DBFILE", dbfile); | 156 | GNUNET_CONFIGURATION_set_value_string(cfg, "TESTBED-UNDERLAY", "DBFILE", dbfile); |
157 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write | 157 | GNUNET_assert(GNUNET_OK == GNUNET_CONFIGURATION_write |
158 | (cfg, "test_testbed_underlay.conf")); | 158 | (cfg, "test_testbed_underlay.conf")); |
159 | GNUNET_CONFIGURATION_destroy (cfg); | 159 | GNUNET_CONFIGURATION_destroy(cfg); |
160 | cfg = NULL; | 160 | cfg = NULL; |
161 | GNUNET_free (dbfile); | 161 | GNUNET_free(dbfile); |
162 | dbfile = NULL; | 162 | dbfile = NULL; |
163 | (void) GNUNET_TESTBED_test_run ("test_testbed_underlay", | 163 | (void)GNUNET_TESTBED_test_run("test_testbed_underlay", |
164 | "test_testbed_underlay.conf", NUM_PEERS, | 164 | "test_testbed_underlay.conf", NUM_PEERS, |
165 | event_mask, NULL, NULL, | 165 | event_mask, NULL, NULL, |
166 | &test_master, NULL); | 166 | &test_master, NULL); |
167 | (void) unlink ("test_testbed_underlay.conf"); | 167 | (void)unlink("test_testbed_underlay.conf"); |
168 | if (GNUNET_OK != result) | 168 | if (GNUNET_OK != result) |
169 | return 1; | 169 | return 1; |
170 | return 0; | 170 | return 0; |