diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-04 20:59:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-04 20:59:41 +0000 |
commit | fa2373ff7a4291216be7c00f76e276ee60aec654 (patch) | |
tree | 7f5da264095f18358b3abe772d88498ba6627407 /src/statistics/statistics_api.c | |
parent | 6cdff36159de7a4fe5bc31564cc7dc3a2f94b0ed (diff) | |
download | gnunet-fa2373ff7a4291216be7c00f76e276ee60aec654.tar.gz gnunet-fa2373ff7a4291216be7c00f76e276ee60aec654.zip |
make gnunet-service-statistics not exit on external shutdown signal as long as there are connected clients to be managed
Diffstat (limited to 'src/statistics/statistics_api.c')
-rw-r--r-- | src/statistics/statistics_api.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c index 2838b7060..100121f2f 100644 --- a/src/statistics/statistics_api.c +++ b/src/statistics/statistics_api.c | |||
@@ -385,10 +385,8 @@ try_connect (struct GNUNET_STATISTICS_Handle *h) | |||
385 | schedule_watch_request (h, h->watches[i]); | 385 | schedule_watch_request (h, h->watches[i]); |
386 | return GNUNET_YES; | 386 | return GNUNET_YES; |
387 | } | 387 | } |
388 | #if DEBUG_STATISTICS | ||
389 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 388 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
390 | _("Failed to connect to statistics service!\n")); | 389 | "Failed to connect to statistics service!\n"); |
391 | #endif | ||
392 | return GNUNET_NO; | 390 | return GNUNET_NO; |
393 | } | 391 | } |
394 | 392 | ||
@@ -444,9 +442,7 @@ process_statistics_value_message (struct GNUNET_STATISTICS_Handle *h, | |||
444 | 442 | ||
445 | if (h->current->aborted) | 443 | if (h->current->aborted) |
446 | { | 444 | { |
447 | #if DEBUG_STATISTICS | ||
448 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Iteration was aborted, ignoring VALUE\n"); | 445 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Iteration was aborted, ignoring VALUE\n"); |
449 | #endif | ||
450 | return GNUNET_OK; /* don't bother */ | 446 | return GNUNET_OK; /* don't bother */ |
451 | } | 447 | } |
452 | size = ntohs (msg->size); | 448 | size = ntohs (msg->size); |
@@ -464,25 +460,19 @@ process_statistics_value_message (struct GNUNET_STATISTICS_Handle *h, | |||
464 | GNUNET_break (0); | 460 | GNUNET_break (0); |
465 | return GNUNET_SYSERR; | 461 | return GNUNET_SYSERR; |
466 | } | 462 | } |
467 | #if DEBUG_STATISTICS | ||
468 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received valid statistic on `%s:%s': %llu\n", | 463 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received valid statistic on `%s:%s': %llu\n", |
469 | service, name, GNUNET_ntohll (smsg->value)); | 464 | service, name, GNUNET_ntohll (smsg->value)); |
470 | #endif | ||
471 | if (GNUNET_OK != | 465 | if (GNUNET_OK != |
472 | h->current->proc (h->current->cls, service, name, | 466 | h->current->proc (h->current->cls, service, name, |
473 | GNUNET_ntohll (smsg->value), | 467 | GNUNET_ntohll (smsg->value), |
474 | 0 != | 468 | 0 != |
475 | (ntohl (smsg->uid) & GNUNET_STATISTICS_PERSIST_BIT))) | 469 | (ntohl (smsg->uid) & GNUNET_STATISTICS_PERSIST_BIT))) |
476 | { | 470 | { |
477 | #if DEBUG_STATISTICS | ||
478 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 471 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
479 | "Processing of remaining statistics aborted by client.\n"); | 472 | "Processing of remaining statistics aborted by client.\n"); |
480 | #endif | ||
481 | h->current->aborted = GNUNET_YES; | 473 | h->current->aborted = GNUNET_YES; |
482 | } | 474 | } |
483 | #if DEBUG_STATISTICS | ||
484 | LOG (GNUNET_ERROR_TYPE_DEBUG, "VALUE processed successfully\n"); | 475 | LOG (GNUNET_ERROR_TYPE_DEBUG, "VALUE processed successfully\n"); |
485 | #endif | ||
486 | return GNUNET_OK; | 476 | return GNUNET_OK; |
487 | } | 477 | } |
488 | 478 | ||
@@ -541,10 +531,8 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg) | |||
541 | 531 | ||
542 | if (msg == NULL) | 532 | if (msg == NULL) |
543 | { | 533 | { |
544 | #if DEBUG_STATISTICS | ||
545 | LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 534 | LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, |
546 | "Error receiving statistics from service, is the service running?\n"); | 535 | "Error receiving statistics from service, is the service running?\n"); |
547 | #endif | ||
548 | do_disconnect (h); | 536 | do_disconnect (h); |
549 | reconnect_later (h); | 537 | reconnect_later (h); |
550 | return; | 538 | return; |
@@ -552,9 +540,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg) | |||
552 | switch (ntohs (msg->type)) | 540 | switch (ntohs (msg->type)) |
553 | { | 541 | { |
554 | case GNUNET_MESSAGE_TYPE_STATISTICS_END: | 542 | case GNUNET_MESSAGE_TYPE_STATISTICS_END: |
555 | #if DEBUG_STATISTICS | ||
556 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received end of statistics marker\n"); | 543 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received end of statistics marker\n"); |
557 | #endif | ||
558 | if (NULL == (c = h->current)) | 544 | if (NULL == (c = h->current)) |
559 | { | 545 | { |
560 | GNUNET_break (0); | 546 | GNUNET_break (0); |
@@ -586,10 +572,8 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg) | |||
586 | return; | 572 | return; |
587 | } | 573 | } |
588 | /* finally, look for more! */ | 574 | /* finally, look for more! */ |
589 | #if DEBUG_STATISTICS | ||
590 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 575 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
591 | "Processing VALUE done, now reading more\n"); | 576 | "Processing VALUE done, now reading more\n"); |
592 | #endif | ||
593 | GNUNET_CLIENT_receive (h->client, &receive_stats, h, | 577 | GNUNET_CLIENT_receive (h->client, &receive_stats, h, |
594 | GNUNET_TIME_absolute_get_remaining (h-> | 578 | GNUNET_TIME_absolute_get_remaining (h-> |
595 | current->timeout)); | 579 | current->timeout)); |
@@ -641,10 +625,8 @@ transmit_get (struct GNUNET_STATISTICS_Handle *handle, size_t size, void *buf) | |||
641 | if (buf == NULL) | 625 | if (buf == NULL) |
642 | { | 626 | { |
643 | /* timeout / error */ | 627 | /* timeout / error */ |
644 | #if DEBUG_STATISTICS | ||
645 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 628 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
646 | "Transmission of request for statistics failed!\n"); | 629 | "Transmission of request for statistics failed!\n"); |
647 | #endif | ||
648 | do_disconnect (handle); | 630 | do_disconnect (handle); |
649 | reconnect_later (handle); | 631 | reconnect_later (handle); |
650 | return 0; | 632 | return 0; |
@@ -662,10 +644,8 @@ transmit_get (struct GNUNET_STATISTICS_Handle *handle, size_t size, void *buf) | |||
662 | c->name)); | 644 | c->name)); |
663 | if (GNUNET_YES != handle->receiving) | 645 | if (GNUNET_YES != handle->receiving) |
664 | { | 646 | { |
665 | #if DEBUG_STATISTICS | ||
666 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 647 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
667 | "Transmission of GET done, now reading response\n"); | 648 | "Transmission of GET done, now reading response\n"); |
668 | #endif | ||
669 | handle->receiving = GNUNET_YES; | 649 | handle->receiving = GNUNET_YES; |
670 | GNUNET_CLIENT_receive (handle->client, &receive_stats, handle, | 650 | GNUNET_CLIENT_receive (handle->client, &receive_stats, handle, |
671 | GNUNET_TIME_absolute_get_remaining (c->timeout)); | 651 | GNUNET_TIME_absolute_get_remaining (c->timeout)); |
@@ -694,18 +674,14 @@ transmit_watch (struct GNUNET_STATISTICS_Handle *handle, size_t size, void *buf) | |||
694 | if (buf == NULL) | 674 | if (buf == NULL) |
695 | { | 675 | { |
696 | /* timeout / error */ | 676 | /* timeout / error */ |
697 | #if DEBUG_STATISTICS | ||
698 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 677 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
699 | "Transmission of request for statistics failed!\n"); | 678 | "Transmission of request for statistics failed!\n"); |
700 | #endif | ||
701 | do_disconnect (handle); | 679 | do_disconnect (handle); |
702 | reconnect_later (handle); | 680 | reconnect_later (handle); |
703 | return 0; | 681 | return 0; |
704 | } | 682 | } |
705 | #if DEBUG_STATISTICS | ||
706 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting watch request for `%s'\n", | 683 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting watch request for `%s'\n", |
707 | handle->current->name); | 684 | handle->current->name); |
708 | #endif | ||
709 | slen1 = strlen (handle->current->subsystem) + 1; | 685 | slen1 = strlen (handle->current->subsystem) + 1; |
710 | slen2 = strlen (handle->current->name) + 1; | 686 | slen2 = strlen (handle->current->name) + 1; |
711 | msize = slen1 + slen2 + sizeof (struct GNUNET_MessageHeader); | 687 | msize = slen1 + slen2 + sizeof (struct GNUNET_MessageHeader); |
@@ -977,10 +953,8 @@ schedule_action (struct GNUNET_STATISTICS_Handle *h) | |||
977 | timeout, GNUNET_YES, | 953 | timeout, GNUNET_YES, |
978 | &transmit_action, h))) | 954 | &transmit_action, h))) |
979 | { | 955 | { |
980 | #if DEBUG_STATISTICS | ||
981 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 956 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
982 | "Failed to transmit request to statistics service.\n"); | 957 | "Failed to transmit request to statistics service.\n"); |
983 | #endif | ||
984 | do_disconnect (h); | 958 | do_disconnect (h); |
985 | reconnect_later (h); | 959 | reconnect_later (h); |
986 | } | 960 | } |