diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/arm/test_exponential_backoff.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/arm/test_exponential_backoff.c')
-rw-r--r-- | src/arm/test_exponential_backoff.c | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c index eb6421d5f..04c52d0eb 100644 --- a/src/arm/test_exponential_backoff.c +++ b/src/arm/test_exponential_backoff.c | |||
@@ -136,8 +136,7 @@ service_shutdown_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
136 | "Received confirmation for service shutdown.\n"); | 136 | "Received confirmation for service shutdown.\n"); |
137 | #endif | 137 | #endif |
138 | shutdown_ctx->confirmed = GNUNET_YES; | 138 | shutdown_ctx->confirmed = GNUNET_YES; |
139 | GNUNET_CLIENT_receive (shutdown_ctx->sock, | 139 | GNUNET_CLIENT_receive (shutdown_ctx->sock, &service_shutdown_handler, |
140 | &service_shutdown_handler, | ||
141 | shutdown_ctx, GNUNET_TIME_UNIT_FOREVER_REL); | 140 | shutdown_ctx, GNUNET_TIME_UNIT_FOREVER_REL); |
142 | break; | 141 | break; |
143 | default: /* Fall through */ | 142 | default: /* Fall through */ |
@@ -197,9 +196,8 @@ write_shutdown (void *cls, size_t size, void *buf) | |||
197 | return 0; /* client disconnected */ | 196 | return 0; /* client disconnected */ |
198 | } | 197 | } |
199 | 198 | ||
200 | GNUNET_CLIENT_receive (shutdown_ctx->sock, | 199 | GNUNET_CLIENT_receive (shutdown_ctx->sock, &service_shutdown_handler, |
201 | &service_shutdown_handler, shutdown_ctx, | 200 | shutdown_ctx, GNUNET_TIME_UNIT_FOREVER_REL); |
202 | GNUNET_TIME_UNIT_FOREVER_REL); | ||
203 | shutdown_ctx->cancel_task = | 201 | shutdown_ctx->cancel_task = |
204 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining | 202 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining |
205 | (shutdown_ctx->timeout), | 203 | (shutdown_ctx->timeout), |
@@ -237,11 +235,9 @@ arm_service_shutdown (struct GNUNET_CLIENT_Connection *sock, | |||
237 | shutdown_ctx->sock = sock; | 235 | shutdown_ctx->sock = sock; |
238 | shutdown_ctx->timeout = GNUNET_TIME_relative_to_absolute (timeout); | 236 | shutdown_ctx->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
239 | GNUNET_CLIENT_notify_transmit_ready (sock, | 237 | GNUNET_CLIENT_notify_transmit_ready (sock, |
240 | sizeof (struct | 238 | sizeof (struct GNUNET_MessageHeader), |
241 | GNUNET_MessageHeader), | 239 | timeout, GNUNET_NO, &write_shutdown, |
242 | timeout, | 240 | shutdown_ctx); |
243 | GNUNET_NO, | ||
244 | &write_shutdown, shutdown_ctx); | ||
245 | } | 241 | } |
246 | 242 | ||
247 | 243 | ||
@@ -255,8 +251,8 @@ arm_notify_stop (void *cls, int success) | |||
255 | } | 251 | } |
256 | 252 | ||
257 | 253 | ||
258 | static void | 254 | static void kill_task (void *cbData, |
259 | kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc); | 255 | const struct GNUNET_SCHEDULER_TaskContext *tc); |
260 | 256 | ||
261 | 257 | ||
262 | static void | 258 | static void |
@@ -272,13 +268,13 @@ static void | |||
272 | arm_notify (void *cls, int success) | 268 | arm_notify (void *cls, int success) |
273 | { | 269 | { |
274 | GNUNET_assert (success == GNUNET_YES); | 270 | GNUNET_assert (success == GNUNET_YES); |
275 | GNUNET_ARM_start_service (arm, | 271 | GNUNET_ARM_start_service (arm, "do-nothing", TIMEOUT, &do_nothing_notify, |
276 | "do-nothing", TIMEOUT, &do_nothing_notify, NULL); | 272 | NULL); |
277 | } | 273 | } |
278 | 274 | ||
279 | 275 | ||
280 | static void | 276 | static void kill_task (void *cbData, |
281 | kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc); | 277 | const struct GNUNET_SCHEDULER_TaskContext *tc); |
282 | 278 | ||
283 | 279 | ||
284 | static void | 280 | static void |
@@ -310,8 +306,7 @@ do_nothing_restarted_notify_task (void *cls, | |||
310 | static void | 306 | static void |
311 | do_test (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) | 307 | do_test (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) |
312 | { | 308 | { |
313 | GNUNET_CLIENT_service_test ("do-nothing", | 309 | GNUNET_CLIENT_service_test ("do-nothing", cfg, TIMEOUT, |
314 | cfg, TIMEOUT, | ||
315 | &do_nothing_restarted_notify_task, NULL); | 310 | &do_nothing_restarted_notify_task, NULL); |
316 | } | 311 | } |
317 | 312 | ||
@@ -335,8 +330,8 @@ kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
335 | waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt); | 330 | waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt); |
336 | 331 | ||
337 | #if LOG_BACKOFF | 332 | #if LOG_BACKOFF |
338 | fprintf (killLogFilePtr, | 333 | fprintf (killLogFilePtr, "Waited for: %llu ms\n", |
339 | "Waited for: %llu ms\n", (unsigned long long) waitedFor.rel_value); | 334 | (unsigned long long) waitedFor.rel_value); |
340 | #endif | 335 | #endif |
341 | } | 336 | } |
342 | else | 337 | else |
@@ -349,8 +344,8 @@ kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
349 | if (trialCount == 12) | 344 | if (trialCount == 12) |
350 | { | 345 | { |
351 | GNUNET_CLIENT_disconnect (doNothingConnection, GNUNET_NO); | 346 | GNUNET_CLIENT_disconnect (doNothingConnection, GNUNET_NO); |
352 | GNUNET_ARM_stop_service (arm, | 347 | GNUNET_ARM_stop_service (arm, "do-nothing", TIMEOUT, &arm_notify_stop, |
353 | "do-nothing", TIMEOUT, &arm_notify_stop, NULL); | 348 | NULL); |
354 | ok = 0; | 349 | ok = 0; |
355 | return; | 350 | return; |
356 | } | 351 | } |
@@ -360,9 +355,8 @@ kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
360 | 355 | ||
361 | 356 | ||
362 | static void | 357 | static void |
363 | task (void *cls, | 358 | task (void *cls, char *const *args, const char *cfgfile, |
364 | char *const *args, | 359 | const struct GNUNET_CONFIGURATION_Handle *c) |
365 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) | ||
366 | { | 360 | { |
367 | cfg = c; | 361 | cfg = c; |
368 | 362 | ||
@@ -393,9 +387,8 @@ check () | |||
393 | /* Running ARM and running the do_nothing task */ | 387 | /* Running ARM and running the do_nothing task */ |
394 | GNUNET_assert (GNUNET_OK == | 388 | GNUNET_assert (GNUNET_OK == |
395 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 389 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, |
396 | argv, | 390 | argv, "test-exponential-backoff", "nohelp", |
397 | "test-exponential-backoff", | 391 | options, &task, NULL)); |
398 | "nohelp", options, &task, NULL)); | ||
399 | 392 | ||
400 | 393 | ||
401 | return ok; | 394 | return ok; |