aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tests/ats-testing-traffic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ats-tests/ats-testing-traffic.c')
-rw-r--r--src/ats-tests/ats-testing-traffic.c359
1 files changed, 185 insertions, 174 deletions
diff --git a/src/ats-tests/ats-testing-traffic.c b/src/ats-tests/ats-testing-traffic.c
index 3756596c9..01462980c 100644
--- a/src/ats-tests/ats-testing-traffic.c
+++ b/src/ats-tests/ats-testing-traffic.c
@@ -1,19 +1,19 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2010-2013, 2016 GNUnet e.V. 3 Copyright (C) 2010-2013, 2016 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License, 7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19 */ 19 */
@@ -33,7 +33,7 @@ static struct TrafficGenerator *tg_tail;
33extern struct GNUNET_ATS_TEST_Topology *top; 33extern struct GNUNET_ATS_TEST_Topology *top;
34 34
35static struct GNUNET_TIME_Relative 35static struct GNUNET_TIME_Relative
36get_delay (struct TrafficGenerator *tg) 36get_delay(struct TrafficGenerator *tg)
37{ 37{
38 struct GNUNET_TIME_Relative delay; 38 struct GNUNET_TIME_Relative delay;
39 struct GNUNET_TIME_Relative time_delta; 39 struct GNUNET_TIME_Relative time_delta;
@@ -43,65 +43,70 @@ get_delay (struct TrafficGenerator *tg)
43 delay.rel_value_us = 0; 43 delay.rel_value_us = 0;
44 44
45 /* Calculate the current transmission rate based on the type of traffic */ 45 /* Calculate the current transmission rate based on the type of traffic */
46 switch (tg->type) { 46 switch (tg->type)
47 {
47 case GNUNET_ATS_TEST_TG_CONSTANT: 48 case GNUNET_ATS_TEST_TG_CONSTANT:
48 if (UINT32_MAX == tg->base_rate) 49 if (UINT32_MAX == tg->base_rate)
49 return GNUNET_TIME_UNIT_ZERO; 50 return GNUNET_TIME_UNIT_ZERO;
50 cur_rate = tg->base_rate; 51 cur_rate = tg->base_rate;
51 break; 52 break;
53
52 case GNUNET_ATS_TEST_TG_LINEAR: 54 case GNUNET_ATS_TEST_TG_LINEAR:
53 time_delta = GNUNET_TIME_absolute_get_duration(tg->time_start); 55 time_delta = GNUNET_TIME_absolute_get_duration(tg->time_start);
54 /* Calculate point of time in the current period */ 56 /* Calculate point of time in the current period */
55 time_delta.rel_value_us = time_delta.rel_value_us % tg->duration_period.rel_value_us; 57 time_delta.rel_value_us = time_delta.rel_value_us % tg->duration_period.rel_value_us;
56 delta_rate = ((double) time_delta.rel_value_us / tg->duration_period.rel_value_us) * 58 delta_rate = ((double)time_delta.rel_value_us / tg->duration_period.rel_value_us) *
57 (tg->max_rate - tg->base_rate); 59 (tg->max_rate - tg->base_rate);
58 if ((tg->max_rate < tg->base_rate) && ((tg->max_rate - tg->base_rate) > tg->base_rate)) 60 if ((tg->max_rate < tg->base_rate) && ((tg->max_rate - tg->base_rate) > tg->base_rate))
59 { 61 {
60 /* This will cause an underflow */ 62 /* This will cause an underflow */
61 GNUNET_break (0); 63 GNUNET_break(0);
62 } 64 }
63 cur_rate = tg->base_rate + delta_rate; 65 cur_rate = tg->base_rate + delta_rate;
64 break; 66 break;
67
65 case GNUNET_ATS_TEST_TG_RANDOM: 68 case GNUNET_ATS_TEST_TG_RANDOM:
66 cur_rate = tg->base_rate + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 69 cur_rate = tg->base_rate + GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK,
67 tg->max_rate - tg->base_rate); 70 tg->max_rate - tg->base_rate);
68 break; 71 break;
72
69 case GNUNET_ATS_TEST_TG_SINUS: 73 case GNUNET_ATS_TEST_TG_SINUS:
70 time_delta = GNUNET_TIME_absolute_get_duration(tg->time_start); 74 time_delta = GNUNET_TIME_absolute_get_duration(tg->time_start);
71 /* Calculate point of time in the current period */ 75 /* Calculate point of time in the current period */
72 time_delta.rel_value_us = time_delta.rel_value_us % tg->duration_period.rel_value_us; 76 time_delta.rel_value_us = time_delta.rel_value_us % tg->duration_period.rel_value_us;
73 if ((tg->max_rate - tg->base_rate) > tg->base_rate) 77 if ((tg->max_rate - tg->base_rate) > tg->base_rate)
74 { 78 {
75 /* This will cause an underflow for second half of sinus period, 79 /* This will cause an underflow for second half of sinus period,
76 * will be detected in general when experiments are loaded */ 80 * will be detected in general when experiments are loaded */
77 GNUNET_break (0); 81 GNUNET_break(0);
78 } 82 }
79 delta_rate = (tg->max_rate - tg->base_rate) * 83 delta_rate = (tg->max_rate - tg->base_rate) *
80 sin ( (2 * M_PI) / ((double) tg->duration_period.rel_value_us) * time_delta.rel_value_us); 84 sin((2 * M_PI) / ((double)tg->duration_period.rel_value_us) * time_delta.rel_value_us);
81 cur_rate = tg->base_rate + delta_rate; 85 cur_rate = tg->base_rate + delta_rate;
82 break; 86 break;
87
83 default: 88 default:
84 return delay; 89 return delay;
85 break; 90 break;
86 } 91 }
87 92
88 if (cur_rate < 0) 93 if (cur_rate < 0)
89 { 94 {
90 cur_rate = 1; 95 cur_rate = 1;
91 } 96 }
92 /* Calculate the delay for the next message based on the current delay */ 97 /* Calculate the delay for the next message based on the current delay */
93 delay.rel_value_us = GNUNET_TIME_UNIT_SECONDS.rel_value_us * TEST_MESSAGE_SIZE / cur_rate; 98 delay.rel_value_us = GNUNET_TIME_UNIT_SECONDS.rel_value_us * TEST_MESSAGE_SIZE / cur_rate;
94 99
95 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 100 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
96 "Current rate is %lld, calculated delay is %llu\n", 101 "Current rate is %lld, calculated delay is %llu\n",
97 cur_rate, 102 cur_rate,
98 (unsigned long long) delay.rel_value_us); 103 (unsigned long long)delay.rel_value_us);
99 return delay; 104 return delay;
100} 105}
101 106
102 107
103static void 108static void
104update_ping_data (void *cls) 109update_ping_data(void *cls)
105{ 110{
106 struct BenchmarkPartner *p = cls; 111 struct BenchmarkPartner *p = cls;
107 struct GNUNET_TIME_Relative delay; 112 struct GNUNET_TIME_Relative delay;
@@ -112,23 +117,23 @@ update_ping_data (void *cls)
112 p->me->total_bytes_sent += TEST_MESSAGE_SIZE; 117 p->me->total_bytes_sent += TEST_MESSAGE_SIZE;
113 118
114 if (NULL == p->tg) 119 if (NULL == p->tg)
115 { 120 {
116 GNUNET_break (0); 121 GNUNET_break(0);
117 return; 122 return;
118 } 123 }
119 delay = get_delay (p->tg); 124 delay = get_delay(p->tg);
120 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 125 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
121 "Delay for next transmission %s\n", 126 "Delay for next transmission %s\n",
122 GNUNET_STRINGS_relative_time_to_string (delay, 127 GNUNET_STRINGS_relative_time_to_string(delay,
123 GNUNET_YES)); 128 GNUNET_YES));
124 p->tg->next_ping_transmission 129 p->tg->next_ping_transmission
125 = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), 130 = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(),
126 delay); 131 delay);
127} 132}
128 133
129 134
130static void 135static void
131comm_schedule_send (void *cls) 136comm_schedule_send(void *cls)
132{ 137{
133 struct BenchmarkPartner *p = cls; 138 struct BenchmarkPartner *p = cls;
134 struct TestMessage *msg; 139 struct TestMessage *msg;
@@ -136,25 +141,25 @@ comm_schedule_send (void *cls)
136 141
137 p->tg->send_task = NULL; 142 p->tg->send_task = NULL;
138 p->last_message_sent = GNUNET_TIME_absolute_get(); 143 p->last_message_sent = GNUNET_TIME_absolute_get();
139 env = GNUNET_MQ_msg (msg, 144 env = GNUNET_MQ_msg(msg,
140 TEST_MESSAGE_TYPE_PING); 145 TEST_MESSAGE_TYPE_PING);
141 memset (msg->padding, 146 memset(msg->padding,
142 'a', 147 'a',
143 sizeof (msg->padding)); 148 sizeof(msg->padding));
144 GNUNET_MQ_notify_sent (env, 149 GNUNET_MQ_notify_sent(env,
145 &update_ping_data, 150 &update_ping_data,
146 p); 151 p);
147 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 152 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
148 "Master [%u]: Sending PING to [%u]\n", 153 "Master [%u]: Sending PING to [%u]\n",
149 p->me->no, 154 p->me->no,
150 p->dest->no); 155 p->dest->no);
151 GNUNET_MQ_send (p->mq, 156 GNUNET_MQ_send(p->mq,
152 env); 157 env);
153} 158}
154 159
155 160
156static void 161static void
157update_pong_data (void *cls) 162update_pong_data(void *cls)
158{ 163{
159 struct BenchmarkPartner *p = cls; 164 struct BenchmarkPartner *p = cls;
160 165
@@ -166,49 +171,50 @@ update_pong_data (void *cls)
166 171
167 172
168void 173void
169GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p) 174GNUNET_ATS_TEST_traffic_handle_ping(struct BenchmarkPartner *p)
170{ 175{
171 struct TestMessage *msg; 176 struct TestMessage *msg;
172 struct GNUNET_MQ_Envelope *env; 177 struct GNUNET_MQ_Envelope *env;
173 178
174 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 179 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
175 "Slave [%u]: Received PING from [%u], sending PONG\n", 180 "Slave [%u]: Received PING from [%u], sending PONG\n",
176 p->me->no, 181 p->me->no,
177 p->dest->no); 182 p->dest->no);
178 p->messages_received++; 183 p->messages_received++;
179 p->bytes_received += TEST_MESSAGE_SIZE; 184 p->bytes_received += TEST_MESSAGE_SIZE;
180 p->me->total_messages_received++; 185 p->me->total_messages_received++;
181 p->me->total_bytes_received += TEST_MESSAGE_SIZE; 186 p->me->total_bytes_received += TEST_MESSAGE_SIZE;
182 187
183 188
184 env = GNUNET_MQ_msg (msg, 189 env = GNUNET_MQ_msg(msg,
185 TEST_MESSAGE_TYPE_PING); 190 TEST_MESSAGE_TYPE_PING);
186 memset (msg->padding, 191 memset(msg->padding,
187 'a', 192 'a',
188 sizeof (msg->padding)); 193 sizeof(msg->padding));
189 GNUNET_MQ_notify_sent (env, 194 GNUNET_MQ_notify_sent(env,
190 &update_pong_data, 195 &update_pong_data,
191 p); 196 p);
192 GNUNET_MQ_send (p->mq, 197 GNUNET_MQ_send(p->mq,
193 env); 198 env);
194} 199}
195 200
196 201
197void 202void
198GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p) 203GNUNET_ATS_TEST_traffic_handle_pong(struct BenchmarkPartner *p)
199{ 204{
200 struct GNUNET_TIME_Relative left; 205 struct GNUNET_TIME_Relative left;
201 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 206
202 "Master [%u]: Received PONG from [%u], next message\n", 207 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
203 p->me->no, 208 "Master [%u]: Received PONG from [%u], next message\n",
204 p->dest->no); 209 p->me->no,
210 p->dest->no);
205 211
206 p->messages_received++; 212 p->messages_received++;
207 p->bytes_received += TEST_MESSAGE_SIZE; 213 p->bytes_received += TEST_MESSAGE_SIZE;
208 p->me->total_messages_received++; 214 p->me->total_messages_received++;
209 p->me->total_bytes_received += TEST_MESSAGE_SIZE; 215 p->me->total_bytes_received += TEST_MESSAGE_SIZE;
210 p->total_app_rtt += GNUNET_TIME_absolute_get_difference(p->last_message_sent, 216 p->total_app_rtt += GNUNET_TIME_absolute_get_difference(p->last_message_sent,
211 GNUNET_TIME_absolute_get()).rel_value_us; 217 GNUNET_TIME_absolute_get()).rel_value_us;
212 218
213 /* Schedule next send event */ 219 /* Schedule next send event */
214 if (NULL == p->tg) 220 if (NULL == p->tg)
@@ -216,23 +222,23 @@ GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p)
216 222
217 left = GNUNET_TIME_absolute_get_remaining(p->tg->next_ping_transmission); 223 left = GNUNET_TIME_absolute_get_remaining(p->tg->next_ping_transmission);
218 if (UINT32_MAX == p->tg->base_rate) 224 if (UINT32_MAX == p->tg->base_rate)
219 { 225 {
220 p->tg->send_task = GNUNET_SCHEDULER_add_now (&comm_schedule_send, p); 226 p->tg->send_task = GNUNET_SCHEDULER_add_now(&comm_schedule_send, p);
221 } 227 }
222 else if (0 == left.rel_value_us) 228 else if (0 == left.rel_value_us)
223 { 229 {
224 p->tg->send_task = GNUNET_SCHEDULER_add_now (&comm_schedule_send, p); 230 p->tg->send_task = GNUNET_SCHEDULER_add_now(&comm_schedule_send, p);
225 } 231 }
226 else 232 else
227 { 233 {
228 /* Enforce minimum transmission rate 1 msg / sec */ 234 /* Enforce minimum transmission rate 1 msg / sec */
229 if (GNUNET_TIME_UNIT_SECONDS.rel_value_us == (left = GNUNET_TIME_relative_min (left, GNUNET_TIME_UNIT_SECONDS)).rel_value_us) 235 if (GNUNET_TIME_UNIT_SECONDS.rel_value_us == (left = GNUNET_TIME_relative_min(left, GNUNET_TIME_UNIT_SECONDS)).rel_value_us)
230 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 236 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
231 "Enforcing minimum send rate between master [%u] and slave [%u]\n", 237 "Enforcing minimum send rate between master [%u] and slave [%u]\n",
232 p->me->no, p->dest->no); 238 p->me->no, p->dest->no);
233 p->tg->send_task = GNUNET_SCHEDULER_add_delayed (left, 239 p->tg->send_task = GNUNET_SCHEDULER_add_delayed(left,
234 &comm_schedule_send, p); 240 &comm_schedule_send, p);
235 } 241 }
236} 242}
237 243
238 244
@@ -250,26 +256,26 @@ GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p)
250 * @return the traffic generator 256 * @return the traffic generator
251 */ 257 */
252struct TrafficGenerator * 258struct TrafficGenerator *
253GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, 259GNUNET_ATS_TEST_generate_traffic_start(struct BenchmarkPeer *src,
254 struct BenchmarkPartner *dest, 260 struct BenchmarkPartner *dest,
255 enum GeneratorType type, 261 enum GeneratorType type,
256 unsigned int base_rate, 262 unsigned int base_rate,
257 unsigned int max_rate, 263 unsigned int max_rate,
258 struct GNUNET_TIME_Relative period, 264 struct GNUNET_TIME_Relative period,
259 struct GNUNET_TIME_Relative duration) 265 struct GNUNET_TIME_Relative duration)
260{ 266{
261 struct TrafficGenerator *tg; 267 struct TrafficGenerator *tg;
262 268
263 if (NULL != dest->tg) 269 if (NULL != dest->tg)
264 { 270 {
265 GNUNET_break (0); 271 GNUNET_break(0);
266 return NULL; 272 return NULL;
267 } 273 }
268 274
269 tg = GNUNET_new (struct TrafficGenerator); 275 tg = GNUNET_new(struct TrafficGenerator);
270 GNUNET_CONTAINER_DLL_insert (tg_head, 276 GNUNET_CONTAINER_DLL_insert(tg_head,
271 tg_tail, 277 tg_tail,
272 tg); 278 tg);
273 tg->type = type; 279 tg->type = type;
274 tg->src = src; 280 tg->src = src;
275 tg->dest = dest; 281 tg->dest = dest;
@@ -279,71 +285,76 @@ GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src,
279 tg->time_start = GNUNET_TIME_absolute_get(); 285 tg->time_start = GNUNET_TIME_absolute_get();
280 tg->next_ping_transmission = GNUNET_TIME_UNIT_FOREVER_ABS; 286 tg->next_ping_transmission = GNUNET_TIME_UNIT_FOREVER_ABS;
281 287
282 switch (type) { 288 switch (type)
283 case GNUNET_ATS_TEST_TG_CONSTANT: 289 {
284 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 290 case GNUNET_ATS_TEST_TG_CONSTANT:
285 "Setting up constant traffic generator master[%u] `%s' and slave [%u] `%s' max %u Bips\n", 291 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
286 dest->me->no, 292 "Setting up constant traffic generator master[%u] `%s' and slave [%u] `%s' max %u Bips\n",
287 GNUNET_i2s (&dest->me->id), 293 dest->me->no,
288 dest->dest->no, 294 GNUNET_i2s(&dest->me->id),
289 GNUNET_i2s (&dest->dest->id), 295 dest->dest->no,
290 base_rate); 296 GNUNET_i2s(&dest->dest->id),
291 break; 297 base_rate);
292 case GNUNET_ATS_TEST_TG_LINEAR: 298 break;
293 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 299
294 "Setting up linear traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bips\n", 300 case GNUNET_ATS_TEST_TG_LINEAR:
295 dest->me->no, 301 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
296 GNUNET_i2s (&dest->me->id), 302 "Setting up linear traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bips\n",
297 dest->dest->no, 303 dest->me->no,
298 GNUNET_i2s (&dest->dest->id), 304 GNUNET_i2s(&dest->me->id),
299 base_rate, 305 dest->dest->no,
300 max_rate); 306 GNUNET_i2s(&dest->dest->id),
301 break; 307 base_rate,
302 case GNUNET_ATS_TEST_TG_SINUS: 308 max_rate);
303 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 309 break;
304 "Setting up sinus traffic generator master[%u] `%s' and slave [%u] `%s' baserate %u Bips, amplitude %u Bps\n", 310
305 dest->me->no, 311 case GNUNET_ATS_TEST_TG_SINUS:
306 GNUNET_i2s (&dest->me->id), 312 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
307 dest->dest->no, 313 "Setting up sinus traffic generator master[%u] `%s' and slave [%u] `%s' baserate %u Bips, amplitude %u Bps\n",
308 GNUNET_i2s (&dest->dest->id), 314 dest->me->no,
309 base_rate, 315 GNUNET_i2s(&dest->me->id),
310 max_rate); 316 dest->dest->no,
311 break; 317 GNUNET_i2s(&dest->dest->id),
312 case GNUNET_ATS_TEST_TG_RANDOM: 318 base_rate,
313 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 319 max_rate);
314 "Setting up random traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bps\n",
315 dest->me->no,
316 GNUNET_i2s (&dest->me->id),
317 dest->dest->no,
318 GNUNET_i2s (&dest->dest->id),
319 base_rate,
320 max_rate);
321 break; 320 break;
321
322 case GNUNET_ATS_TEST_TG_RANDOM:
323 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
324 "Setting up random traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bps\n",
325 dest->me->no,
326 GNUNET_i2s(&dest->me->id),
327 dest->dest->no,
328 GNUNET_i2s(&dest->dest->id),
329 base_rate,
330 max_rate);
331 break;
332
322 default: 333 default:
323 break; 334 break;
324 } 335 }
325 336
326 dest->tg = tg; 337 dest->tg = tg;
327 tg->send_task 338 tg->send_task
328 = GNUNET_SCHEDULER_add_now (&comm_schedule_send, 339 = GNUNET_SCHEDULER_add_now(&comm_schedule_send,
329 dest); 340 dest);
330 return tg; 341 return tg;
331} 342}
332 343
333 344
334void 345void
335GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg) 346GNUNET_ATS_TEST_generate_traffic_stop(struct TrafficGenerator *tg)
336{ 347{
337 GNUNET_CONTAINER_DLL_remove (tg_head, 348 GNUNET_CONTAINER_DLL_remove(tg_head,
338 tg_tail, 349 tg_tail,
339 tg); 350 tg);
340 tg->dest->tg = NULL; 351 tg->dest->tg = NULL;
341 if (NULL != tg->send_task) 352 if (NULL != tg->send_task)
342 { 353 {
343 GNUNET_SCHEDULER_cancel (tg->send_task); 354 GNUNET_SCHEDULER_cancel(tg->send_task);
344 tg->send_task = NULL; 355 tg->send_task = NULL;
345 } 356 }
346 GNUNET_free (tg); 357 GNUNET_free(tg);
347} 358}
348 359
349 360
@@ -351,17 +362,17 @@ GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg)
351 * Stop all traffic generators 362 * Stop all traffic generators
352 */ 363 */
353void 364void
354GNUNET_ATS_TEST_generate_traffic_stop_all () 365GNUNET_ATS_TEST_generate_traffic_stop_all()
355{ 366{
356 struct TrafficGenerator *cur; 367 struct TrafficGenerator *cur;
357 struct TrafficGenerator *next; 368 struct TrafficGenerator *next;
358 369
359 next = tg_head; 370 next = tg_head;
360 for (cur = next; NULL != cur; cur = next) 371 for (cur = next; NULL != cur; cur = next)
361 { 372 {
362 next = cur->next; 373 next = cur->next;
363 GNUNET_ATS_TEST_generate_traffic_stop(cur); 374 GNUNET_ATS_TEST_generate_traffic_stop(cur);
364 } 375 }
365} 376}
366 377
367/* end of file ats-testing-traffic.c */ 378/* end of file ats-testing-traffic.c */