diff options
Diffstat (limited to 'src/arm/test_exponential_backoff.c')
-rw-r--r-- | src/arm/test_exponential_backoff.c | 292 |
1 files changed, 138 insertions, 154 deletions
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c index f40252a03..eb6421d5f 100644 --- a/src/arm/test_exponential_backoff.c +++ b/src/arm/test_exponential_backoff.c | |||
@@ -102,58 +102,55 @@ service_shutdown_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
102 | { | 102 | { |
103 | struct ShutdownContext *shutdown_ctx = cls; | 103 | struct ShutdownContext *shutdown_ctx = cls; |
104 | 104 | ||
105 | if ((msg == NULL) && (shutdown_ctx->confirmed != GNUNET_YES)) | 105 | if ((msg == NULL) && (shutdown_ctx->confirmed != GNUNET_YES)) |
106 | { | 106 | { |
107 | /* Means the other side closed the connection and never confirmed a shutdown */ | 107 | /* Means the other side closed the connection and never confirmed a shutdown */ |
108 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 108 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
109 | "Service handle shutdown before ACK!\n"); | 109 | "Service handle shutdown before ACK!\n"); |
110 | if (shutdown_ctx->cont != NULL) | 110 | if (shutdown_ctx->cont != NULL) |
111 | shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_SYSERR); | 111 | shutdown_ctx->cont (shutdown_ctx->cont_cls, GNUNET_SYSERR); |
112 | GNUNET_SCHEDULER_cancel(shutdown_ctx->cancel_task); | 112 | GNUNET_SCHEDULER_cancel (shutdown_ctx->cancel_task); |
113 | GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); | 113 | GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); |
114 | GNUNET_free(shutdown_ctx); | 114 | GNUNET_free (shutdown_ctx); |
115 | } | 115 | } |
116 | else if ((msg == NULL) && (shutdown_ctx->confirmed == GNUNET_YES)) | 116 | else if ((msg == NULL) && (shutdown_ctx->confirmed == GNUNET_YES)) |
117 | { | 117 | { |
118 | #if VERBOSE | 118 | #if VERBOSE |
119 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 119 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service shutdown complete.\n"); |
120 | "Service shutdown complete.\n"); | ||
121 | #endif | 120 | #endif |
122 | if (shutdown_ctx->cont != NULL) | 121 | if (shutdown_ctx->cont != NULL) |
123 | shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_NO); | 122 | shutdown_ctx->cont (shutdown_ctx->cont_cls, GNUNET_NO); |
124 | 123 | ||
125 | GNUNET_SCHEDULER_cancel(shutdown_ctx->cancel_task); | 124 | GNUNET_SCHEDULER_cancel (shutdown_ctx->cancel_task); |
126 | GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); | 125 | GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); |
127 | GNUNET_free(shutdown_ctx); | 126 | GNUNET_free (shutdown_ctx); |
128 | } | 127 | } |
129 | else | 128 | else |
129 | { | ||
130 | GNUNET_assert (ntohs (msg->size) == sizeof (struct GNUNET_MessageHeader)); | ||
131 | switch (ntohs (msg->type)) | ||
130 | { | 132 | { |
131 | GNUNET_assert(ntohs(msg->size) == sizeof(struct GNUNET_MessageHeader)); | 133 | case GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN_ACK: |
132 | switch (ntohs(msg->type)) | ||
133 | { | ||
134 | case GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN_ACK: | ||
135 | #if VERBOSE | 134 | #if VERBOSE |
136 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 135 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
137 | "Received confirmation for service shutdown.\n"); | 136 | "Received confirmation for service shutdown.\n"); |
138 | #endif | 137 | #endif |
139 | shutdown_ctx->confirmed = GNUNET_YES; | 138 | shutdown_ctx->confirmed = GNUNET_YES; |
140 | GNUNET_CLIENT_receive (shutdown_ctx->sock, | 139 | GNUNET_CLIENT_receive (shutdown_ctx->sock, |
141 | &service_shutdown_handler, | 140 | &service_shutdown_handler, |
142 | shutdown_ctx, | 141 | shutdown_ctx, GNUNET_TIME_UNIT_FOREVER_REL); |
143 | GNUNET_TIME_UNIT_FOREVER_REL); | 142 | break; |
144 | break; | 143 | default: /* Fall through */ |
145 | default: /* Fall through */ | 144 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Service shutdown refused!\n"); |
146 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, | 145 | if (shutdown_ctx->cont != NULL) |
147 | "Service shutdown refused!\n"); | 146 | shutdown_ctx->cont (shutdown_ctx->cont_cls, GNUNET_YES); |
148 | if (shutdown_ctx->cont != NULL) | 147 | |
149 | shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_YES); | 148 | GNUNET_SCHEDULER_cancel (shutdown_ctx->cancel_task); |
150 | 149 | GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); | |
151 | GNUNET_SCHEDULER_cancel(shutdown_ctx->cancel_task); | 150 | GNUNET_free (shutdown_ctx); |
152 | GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); | 151 | break; |
153 | GNUNET_free(shutdown_ctx); | ||
154 | break; | ||
155 | } | ||
156 | } | 152 | } |
153 | } | ||
157 | } | 154 | } |
158 | 155 | ||
159 | /** | 156 | /** |
@@ -162,14 +159,16 @@ service_shutdown_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
162 | * @param cls closure | 159 | * @param cls closure |
163 | * @param tc context information (why was this task triggered now) | 160 | * @param tc context information (why was this task triggered now) |
164 | */ | 161 | */ |
165 | void service_shutdown_cancel (void *cls, | 162 | void |
166 | const struct GNUNET_SCHEDULER_TaskContext * tc) | 163 | service_shutdown_cancel (void *cls, |
164 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
167 | { | 165 | { |
168 | struct ShutdownContext *shutdown_ctx = cls; | 166 | struct ShutdownContext *shutdown_ctx = cls; |
169 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "service_shutdown_cancel called!\n"); | 167 | |
170 | shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_SYSERR); | 168 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "service_shutdown_cancel called!\n"); |
169 | shutdown_ctx->cont (shutdown_ctx->cont_cls, GNUNET_SYSERR); | ||
171 | GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); | 170 | GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); |
172 | GNUNET_free(shutdown_ctx); | 171 | GNUNET_free (shutdown_ctx); |
173 | } | 172 | } |
174 | 173 | ||
175 | 174 | ||
@@ -189,21 +188,22 @@ write_shutdown (void *cls, size_t size, void *buf) | |||
189 | struct ShutdownContext *shutdown_ctx = cls; | 188 | struct ShutdownContext *shutdown_ctx = cls; |
190 | 189 | ||
191 | if (size < sizeof (struct GNUNET_MessageHeader)) | 190 | if (size < sizeof (struct GNUNET_MessageHeader)) |
192 | { | 191 | { |
193 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 192 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
194 | _("Failed to transmit shutdown request to client.\n")); | 193 | _("Failed to transmit shutdown request to client.\n")); |
195 | shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_SYSERR); | 194 | shutdown_ctx->cont (shutdown_ctx->cont_cls, GNUNET_SYSERR); |
196 | GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); | 195 | GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); |
197 | GNUNET_free(shutdown_ctx); | 196 | GNUNET_free (shutdown_ctx); |
198 | return 0; /* client disconnected */ | 197 | return 0; /* client disconnected */ |
199 | } | 198 | } |
200 | 199 | ||
201 | GNUNET_CLIENT_receive (shutdown_ctx->sock, | 200 | GNUNET_CLIENT_receive (shutdown_ctx->sock, |
202 | &service_shutdown_handler, shutdown_ctx, | 201 | &service_shutdown_handler, shutdown_ctx, |
203 | GNUNET_TIME_UNIT_FOREVER_REL); | 202 | GNUNET_TIME_UNIT_FOREVER_REL); |
204 | shutdown_ctx->cancel_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining(shutdown_ctx->timeout), | 203 | shutdown_ctx->cancel_task = |
205 | &service_shutdown_cancel, | 204 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining |
206 | shutdown_ctx); | 205 | (shutdown_ctx->timeout), |
206 | &service_shutdown_cancel, shutdown_ctx); | ||
207 | msg = (struct GNUNET_MessageHeader *) buf; | 207 | msg = (struct GNUNET_MessageHeader *) buf; |
208 | msg->type = htons (GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN); | 208 | msg->type = htons (GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN); |
209 | msg->size = htons (sizeof (struct GNUNET_MessageHeader)); | 209 | msg->size = htons (sizeof (struct GNUNET_MessageHeader)); |
@@ -226,22 +226,22 @@ write_shutdown (void *cls, size_t size, void *buf) | |||
226 | */ | 226 | */ |
227 | static void | 227 | static void |
228 | arm_service_shutdown (struct GNUNET_CLIENT_Connection *sock, | 228 | arm_service_shutdown (struct GNUNET_CLIENT_Connection *sock, |
229 | struct GNUNET_TIME_Relative timeout, | 229 | struct GNUNET_TIME_Relative timeout, |
230 | GNUNET_CLIENT_ShutdownTask cont, | 230 | GNUNET_CLIENT_ShutdownTask cont, void *cont_cls) |
231 | void *cont_cls) | ||
232 | { | 231 | { |
233 | struct ShutdownContext *shutdown_ctx; | 232 | struct ShutdownContext *shutdown_ctx; |
234 | shutdown_ctx = GNUNET_malloc(sizeof(struct ShutdownContext)); | 233 | |
234 | shutdown_ctx = GNUNET_malloc (sizeof (struct ShutdownContext)); | ||
235 | shutdown_ctx->cont = cont; | 235 | shutdown_ctx->cont = cont; |
236 | shutdown_ctx->cont_cls = cont_cls; | 236 | shutdown_ctx->cont_cls = cont_cls; |
237 | shutdown_ctx->sock = sock; | 237 | shutdown_ctx->sock = sock; |
238 | shutdown_ctx->timeout = GNUNET_TIME_relative_to_absolute(timeout); | 238 | shutdown_ctx->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
239 | GNUNET_CLIENT_notify_transmit_ready (sock, | 239 | GNUNET_CLIENT_notify_transmit_ready (sock, |
240 | sizeof (struct | 240 | sizeof (struct |
241 | GNUNET_MessageHeader), | 241 | GNUNET_MessageHeader), |
242 | timeout, | 242 | timeout, |
243 | GNUNET_NO, | 243 | GNUNET_NO, |
244 | &write_shutdown, shutdown_ctx); | 244 | &write_shutdown, shutdown_ctx); |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
@@ -256,8 +256,7 @@ arm_notify_stop (void *cls, int success) | |||
256 | 256 | ||
257 | 257 | ||
258 | static void | 258 | static void |
259 | kill_task (void *cbData, | 259 | kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc); |
260 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
261 | 260 | ||
262 | 261 | ||
263 | static void | 262 | static void |
@@ -265,65 +264,55 @@ do_nothing_notify (void *cls, int success) | |||
265 | { | 264 | { |
266 | GNUNET_assert (success == GNUNET_YES); | 265 | GNUNET_assert (success == GNUNET_YES); |
267 | ok = 1; | 266 | ok = 1; |
268 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 267 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &kill_task, NULL); |
269 | &kill_task, NULL); | ||
270 | } | 268 | } |
271 | 269 | ||
272 | 270 | ||
273 | static void | 271 | static void |
274 | arm_notify (void *cls, int success) | 272 | arm_notify (void *cls, int success) |
275 | { | 273 | { |
276 | GNUNET_assert (success == GNUNET_YES); | 274 | GNUNET_assert (success == GNUNET_YES); |
277 | GNUNET_ARM_start_service (arm, | 275 | GNUNET_ARM_start_service (arm, |
278 | "do-nothing", TIMEOUT, | 276 | "do-nothing", TIMEOUT, &do_nothing_notify, NULL); |
279 | &do_nothing_notify, NULL); | ||
280 | } | 277 | } |
281 | 278 | ||
282 | 279 | ||
283 | static void | 280 | static void |
284 | kill_task (void *cbData, | 281 | kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc); |
285 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
286 | 282 | ||
287 | 283 | ||
288 | static void | 284 | static void |
289 | do_nothing_restarted_notify_task (void *cls, | 285 | do_nothing_restarted_notify_task (void *cls, |
290 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 286 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
291 | { | 287 | { |
292 | static char a; | 288 | static char a; |
293 | 289 | ||
294 | trialCount++; | 290 | trialCount++; |
295 | 291 | ||
296 | #if LOG_BACKOFF | 292 | #if LOG_BACKOFF |
297 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | 293 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) |
298 | { | 294 | { |
299 | fprintf(killLogFilePtr, | 295 | fprintf (killLogFilePtr, "%d.Reason is shutdown!\n", trialCount); |
300 | "%d.Reason is shutdown!\n", | 296 | } |
301 | trialCount); | 297 | else if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) |
302 | } | 298 | { |
303 | else if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) | 299 | fprintf (killLogFilePtr, "%d.Reason is timeout!\n", trialCount); |
304 | { | 300 | } |
305 | fprintf(killLogFilePtr, | 301 | else if ((tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE) != 0) |
306 | "%d.Reason is timeout!\n", | 302 | { |
307 | trialCount); | 303 | fprintf (killLogFilePtr, "%d.Service is running!\n", trialCount); |
308 | } | 304 | } |
309 | else if ((tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE) != 0) | ||
310 | { | ||
311 | fprintf(killLogFilePtr, | ||
312 | "%d.Service is running!\n", | ||
313 | trialCount); | ||
314 | } | ||
315 | #endif | 305 | #endif |
316 | GNUNET_SCHEDULER_add_now (&kill_task, &a); | 306 | GNUNET_SCHEDULER_add_now (&kill_task, &a); |
317 | } | 307 | } |
318 | 308 | ||
319 | 309 | ||
320 | static void | 310 | static void |
321 | do_test (void *cbData, | 311 | do_test (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) |
322 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 312 | { |
323 | { | 313 | GNUNET_CLIENT_service_test ("do-nothing", |
324 | GNUNET_CLIENT_service_test("do-nothing", | 314 | cfg, TIMEOUT, |
325 | cfg, TIMEOUT, | 315 | &do_nothing_restarted_notify_task, NULL); |
326 | &do_nothing_restarted_notify_task, NULL); | ||
327 | } | 316 | } |
328 | 317 | ||
329 | 318 | ||
@@ -331,63 +320,56 @@ static void | |||
331 | shutdown_cont (void *cls, int reason) | 320 | shutdown_cont (void *cls, int reason) |
332 | { | 321 | { |
333 | trialCount++; | 322 | trialCount++; |
334 | startedWaitingAt = GNUNET_TIME_absolute_get(); | 323 | startedWaitingAt = GNUNET_TIME_absolute_get (); |
335 | GNUNET_SCHEDULER_add_delayed (waitedFor, | 324 | GNUNET_SCHEDULER_add_delayed (waitedFor, &do_test, NULL); |
336 | &do_test, | ||
337 | NULL); | ||
338 | } | 325 | } |
339 | 326 | ||
340 | 327 | ||
341 | static void | 328 | static void |
342 | kill_task (void *cbData, | 329 | kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) |
343 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
344 | { | 330 | { |
345 | static struct GNUNET_CLIENT_Connection * doNothingConnection = NULL; | 331 | static struct GNUNET_CLIENT_Connection *doNothingConnection = NULL; |
332 | |||
333 | if (NULL != cbData) | ||
334 | { | ||
335 | waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt); | ||
346 | 336 | ||
347 | if (NULL != cbData) | ||
348 | { | ||
349 | waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt); | ||
350 | |||
351 | #if LOG_BACKOFF | 337 | #if LOG_BACKOFF |
352 | fprintf(killLogFilePtr, | 338 | fprintf (killLogFilePtr, |
353 | "Waited for: %llu ms\n", | 339 | "Waited for: %llu ms\n", (unsigned long long) waitedFor.rel_value); |
354 | (unsigned long long) waitedFor.rel_value); | ||
355 | #endif | 340 | #endif |
356 | } | 341 | } |
357 | else | 342 | else |
358 | { | 343 | { |
359 | waitedFor.rel_value = 0; | 344 | waitedFor.rel_value = 0; |
360 | } | 345 | } |
361 | /* Connect to the doNothing task */ | 346 | /* Connect to the doNothing task */ |
362 | doNothingConnection = GNUNET_CLIENT_connect ("do-nothing", cfg); | 347 | doNothingConnection = GNUNET_CLIENT_connect ("do-nothing", cfg); |
363 | GNUNET_assert (doNothingConnection != NULL); | 348 | GNUNET_assert (doNothingConnection != NULL); |
364 | if (trialCount == 12) { | 349 | if (trialCount == 12) |
350 | { | ||
365 | GNUNET_CLIENT_disconnect (doNothingConnection, GNUNET_NO); | 351 | GNUNET_CLIENT_disconnect (doNothingConnection, GNUNET_NO); |
366 | GNUNET_ARM_stop_service (arm, | 352 | GNUNET_ARM_stop_service (arm, |
367 | "do-nothing", | 353 | "do-nothing", TIMEOUT, &arm_notify_stop, NULL); |
368 | TIMEOUT, | ||
369 | &arm_notify_stop, NULL); | ||
370 | ok = 0; | 354 | ok = 0; |
371 | return; | 355 | return; |
372 | } | 356 | } |
373 | /* Use the created connection to kill the doNothingTask */ | 357 | /* Use the created connection to kill the doNothingTask */ |
374 | arm_service_shutdown(doNothingConnection, | 358 | arm_service_shutdown (doNothingConnection, TIMEOUT, &shutdown_cont, NULL); |
375 | TIMEOUT, | ||
376 | &shutdown_cont, NULL); | ||
377 | } | 359 | } |
378 | 360 | ||
379 | 361 | ||
380 | static void | 362 | static void |
381 | task (void *cls, | 363 | task (void *cls, |
382 | char *const *args, | 364 | char *const *args, |
383 | const char *cfgfile, | 365 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
384 | const struct GNUNET_CONFIGURATION_Handle *c) | ||
385 | { | 366 | { |
386 | cfg = c; | 367 | cfg = c; |
387 | 368 | ||
388 | arm = GNUNET_ARM_connect (cfg,NULL); | 369 | arm = GNUNET_ARM_connect (cfg, NULL); |
389 | #if START_ARM | 370 | #if START_ARM |
390 | GNUNET_ARM_start_service (arm, "arm", GNUNET_TIME_UNIT_ZERO, &arm_notify, NULL); | 371 | GNUNET_ARM_start_service (arm, "arm", GNUNET_TIME_UNIT_ZERO, &arm_notify, |
372 | NULL); | ||
391 | #else | 373 | #else |
392 | arm_do_nothing (NULL, GNUNET_YES); | 374 | arm_do_nothing (NULL, GNUNET_YES); |
393 | #endif | 375 | #endif |
@@ -407,39 +389,41 @@ check () | |||
407 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 389 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
408 | GNUNET_GETOPT_OPTION_END | 390 | GNUNET_GETOPT_OPTION_END |
409 | }; | 391 | }; |
410 | 392 | ||
411 | /* Running ARM and running the do_nothing task */ | 393 | /* Running ARM and running the do_nothing task */ |
412 | GNUNET_assert (GNUNET_OK == | 394 | GNUNET_assert (GNUNET_OK == |
413 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 395 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, |
414 | argv, | 396 | argv, |
415 | "test-exponential-backoff", | 397 | "test-exponential-backoff", |
416 | "nohelp", options, &task, NULL)); | 398 | "nohelp", options, &task, NULL)); |
417 | 399 | ||
418 | 400 | ||
419 | return ok; | 401 | return ok; |
420 | } | 402 | } |
421 | 403 | ||
422 | static int | 404 | static int |
423 | init() | 405 | init () |
424 | { | 406 | { |
425 | #if LOG_BACKOFF | 407 | #if LOG_BACKOFF |
426 | killLogFileName = GNUNET_DISK_mktemp("exponential-backoff-waiting.log"); | 408 | killLogFileName = GNUNET_DISK_mktemp ("exponential-backoff-waiting.log"); |
427 | if (NULL == (killLogFilePtr = FOPEN(killLogFileName, "w"))) { | 409 | if (NULL == (killLogFilePtr = FOPEN (killLogFileName, "w"))) |
428 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fopen", killLogFileName); | 410 | { |
411 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fopen", | ||
412 | killLogFileName); | ||
429 | GNUNET_free (killLogFileName); | 413 | GNUNET_free (killLogFileName); |
430 | return GNUNET_SYSERR; | 414 | return GNUNET_SYSERR; |
431 | } | 415 | } |
432 | #endif | 416 | #endif |
433 | return GNUNET_OK; | 417 | return GNUNET_OK; |
434 | } | 418 | } |
435 | 419 | ||
436 | 420 | ||
437 | static void | 421 | static void |
438 | houseKeep() | 422 | houseKeep () |
439 | { | 423 | { |
440 | #if LOG_BACKOFF | 424 | #if LOG_BACKOFF |
441 | GNUNET_assert (0 == fclose (killLogFilePtr)); | 425 | GNUNET_assert (0 == fclose (killLogFilePtr)); |
442 | GNUNET_free(killLogFileName); | 426 | GNUNET_free (killLogFileName); |
443 | #endif | 427 | #endif |
444 | } | 428 | } |
445 | 429 | ||
@@ -456,10 +440,10 @@ main (int argc, char *argv[]) | |||
456 | "WARNING", | 440 | "WARNING", |
457 | #endif | 441 | #endif |
458 | NULL); | 442 | NULL); |
459 | 443 | ||
460 | init(); | 444 | init (); |
461 | ret = check (); | 445 | ret = check (); |
462 | houseKeep(); | 446 | houseKeep (); |
463 | return ret; | 447 | return ret; |
464 | } | 448 | } |
465 | 449 | ||