diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-05 21:01:09 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-05 21:01:09 +0000 |
commit | e3bdfdc49e5691ec2949d8e6ecf4cab469b9e224 (patch) | |
tree | 01722102a66b064862414b14b690f3c4d68154b3 /src/statistics | |
parent | 0d7e2e9f51debb9860595291a70918e76c8a420e (diff) | |
download | gnunet-e3bdfdc49e5691ec2949d8e6ecf4cab469b9e224.tar.gz gnunet-e3bdfdc49e5691ec2949d8e6ecf4cab469b9e224.zip |
-fixing #2196
Diffstat (limited to 'src/statistics')
-rw-r--r-- | src/statistics/gnunet-service-statistics.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/statistics/gnunet-service-statistics.c b/src/statistics/gnunet-service-statistics.c index c57013987..544bf6a43 100644 --- a/src/statistics/gnunet-service-statistics.c +++ b/src/statistics/gnunet-service-statistics.c | |||
@@ -391,6 +391,11 @@ make_client_entry (struct GNUNET_SERVER_Client *client) | |||
391 | return ce; | 391 | return ce; |
392 | ce = ce->next; | 392 | ce = ce->next; |
393 | } | 393 | } |
394 | if (NULL == nc) | ||
395 | { | ||
396 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
397 | return NULL; | ||
398 | } | ||
394 | ce = GNUNET_malloc (sizeof (struct ClientEntry)); | 399 | ce = GNUNET_malloc (sizeof (struct ClientEntry)); |
395 | ce->client = client; | 400 | ce->client = client; |
396 | GNUNET_SERVER_client_keep (client); | 401 | GNUNET_SERVER_client_keep (client); |
@@ -419,8 +424,9 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, | |||
419 | struct StatsEntry *pos; | 424 | struct StatsEntry *pos; |
420 | size_t size; | 425 | size_t size; |
421 | 426 | ||
422 | if (client != NULL) | 427 | if ( (NULL != client) && |
423 | make_client_entry (client); | 428 | (NULL == make_client_entry (client)) ) |
429 | return; /* new client during shutdown */ | ||
424 | size = ntohs (message->size) - sizeof (struct GNUNET_MessageHeader); | 430 | size = ntohs (message->size) - sizeof (struct GNUNET_MessageHeader); |
425 | if (size != | 431 | if (size != |
426 | GNUNET_STRINGS_buffer_tokenize ((const char *) &message[1], size, 2, | 432 | GNUNET_STRINGS_buffer_tokenize ((const char *) &message[1], size, 2, |
@@ -494,8 +500,9 @@ handle_set (void *cls, struct GNUNET_SERVER_Client *client, | |||
494 | int64_t delta; | 500 | int64_t delta; |
495 | int changed; | 501 | int changed; |
496 | 502 | ||
497 | if (client != NULL) | 503 | if ( (NULL != client) && |
498 | make_client_entry (client); | 504 | (NULL == make_client_entry (client)) ) |
505 | return; /* new client during shutdown */ | ||
499 | msize = ntohs (message->size); | 506 | msize = ntohs (message->size); |
500 | if (msize < sizeof (struct GNUNET_STATISTICS_SetMessage)) | 507 | if (msize < sizeof (struct GNUNET_STATISTICS_SetMessage)) |
501 | { | 508 | { |
@@ -606,6 +613,11 @@ handle_watch (void *cls, struct GNUNET_SERVER_Client *client, | |||
606 | struct WatchEntry *we; | 613 | struct WatchEntry *we; |
607 | size_t slen; | 614 | size_t slen; |
608 | 615 | ||
616 | if (NULL == nc) | ||
617 | { | ||
618 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
619 | return; | ||
620 | } | ||
609 | ce = make_client_entry (client); | 621 | ce = make_client_entry (client); |
610 | msize = ntohs (message->size); | 622 | msize = ntohs (message->size); |
611 | if (msize < sizeof (struct GNUNET_MessageHeader)) | 623 | if (msize < sizeof (struct GNUNET_MessageHeader)) |
@@ -672,8 +684,11 @@ do_shutdown () | |||
672 | struct StatsEntry *se; | 684 | struct StatsEntry *se; |
673 | 685 | ||
674 | save (); | 686 | save (); |
675 | GNUNET_SERVER_notification_context_destroy (nc); | 687 | if (NULL != nc) |
676 | nc = NULL; | 688 | { |
689 | GNUNET_SERVER_notification_context_destroy (nc); | ||
690 | nc = NULL; | ||
691 | } | ||
677 | GNUNET_assert (NULL == client_head); | 692 | GNUNET_assert (NULL == client_head); |
678 | while (NULL != (se = start)) | 693 | while (NULL != (se = start)) |
679 | { | 694 | { |