diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-05-25 15:53:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-05-25 15:53:05 +0000 |
commit | 7e15432358bcfd05508c3eab9a47b14e8301b199 (patch) | |
tree | c3799de58f9fa4f4b7f84e252e0fb05fccd3d8b3 /src/peerinfo | |
parent | 25952dc88f6e0f2de777c76777139435affbcd59 (diff) | |
download | gnunet-7e15432358bcfd05508c3eab9a47b14e8301b199.tar.gz gnunet-7e15432358bcfd05508c3eab9a47b14e8301b199.zip |
nicer logging
Diffstat (limited to 'src/peerinfo')
-rw-r--r-- | src/peerinfo/gnunet-service-peerinfo.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index 8402e7b23..e8ac5ef4a 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c | |||
@@ -496,9 +496,11 @@ send_to_each_host (const struct GNUNET_PeerIdentity *only, | |||
496 | uint16_t hs; | 496 | uint16_t hs; |
497 | char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE]; | 497 | char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE]; |
498 | struct GNUNET_SERVER_TransmitContext *tc; | 498 | struct GNUNET_SERVER_TransmitContext *tc; |
499 | int match; | ||
499 | 500 | ||
500 | tc = GNUNET_SERVER_transmit_context_create (client); | 501 | tc = GNUNET_SERVER_transmit_context_create (client); |
501 | pos = hosts; | 502 | match = GNUNET_NO; |
503 | pos = hosts; | ||
502 | while (pos != NULL) | 504 | while (pos != NULL) |
503 | { | 505 | { |
504 | if ((only == NULL) || | 506 | if ((only == NULL) || |
@@ -516,6 +518,7 @@ send_to_each_host (const struct GNUNET_PeerIdentity *only, | |||
516 | GNUNET_SERVER_MAX_MESSAGE_SIZE - | 518 | GNUNET_SERVER_MAX_MESSAGE_SIZE - |
517 | sizeof (struct InfoMessage)); | 519 | sizeof (struct InfoMessage)); |
518 | memcpy (&im[1], pos->hello, hs); | 520 | memcpy (&im[1], pos->hello, hs); |
521 | match = GNUNET_YES; | ||
519 | } | 522 | } |
520 | im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO); | 523 | im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO); |
521 | im->header.size = htons (sizeof (struct InfoMessage) + hs); | 524 | im->header.size = htons (sizeof (struct InfoMessage) + hs); |
@@ -526,6 +529,12 @@ send_to_each_host (const struct GNUNET_PeerIdentity *only, | |||
526 | } | 529 | } |
527 | pos = pos->next; | 530 | pos = pos->next; |
528 | } | 531 | } |
532 | if ( (only != NULL) && | ||
533 | (match == GNUNET_NO) ) | ||
534 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
535 | "No `%s' message was found for peer `%4s'\n", | ||
536 | "HELLO", | ||
537 | GNUNET_i2s (only)); | ||
529 | GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0, | 538 | GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0, |
530 | GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END); | 539 | GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END); |
531 | GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL); | 540 | GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL); |
@@ -669,6 +678,12 @@ handle_hello (void *cls, | |||
669 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 678 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
670 | return; | 679 | return; |
671 | } | 680 | } |
681 | #if DEBUG_PEERINFO | ||
682 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
683 | "`%s' message received for peer `%4s'\n", | ||
684 | "HELLO", | ||
685 | GNUNET_i2s (&pid)); | ||
686 | #endif | ||
672 | bind_address (&pid, hello); | 687 | bind_address (&pid, hello); |
673 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 688 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
674 | } | 689 | } |
@@ -689,6 +704,12 @@ handle_get (void *cls, | |||
689 | const struct ListPeerMessage *lpm; | 704 | const struct ListPeerMessage *lpm; |
690 | 705 | ||
691 | lpm = (const struct ListPeerMessage *) message; | 706 | lpm = (const struct ListPeerMessage *) message; |
707 | #if DEBUG_PEERINFO | ||
708 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
709 | "`%s' message received for peer `%4s'\n", | ||
710 | "GET", | ||
711 | GNUNET_i2s (&lpm->peer)); | ||
712 | #endif | ||
692 | send_to_each_host (&lpm->peer, ntohl (lpm->trust_change), client); | 713 | send_to_each_host (&lpm->peer, ntohl (lpm->trust_change), client); |
693 | } | 714 | } |
694 | 715 | ||
@@ -708,6 +729,11 @@ handle_get_all (void *cls, | |||
708 | const struct ListAllPeersMessage *lpm; | 729 | const struct ListAllPeersMessage *lpm; |
709 | 730 | ||
710 | lpm = (const struct ListAllPeersMessage *) message; | 731 | lpm = (const struct ListAllPeersMessage *) message; |
732 | #if DEBUG_PEERINFO | ||
733 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
734 | "`%s' message received\n", | ||
735 | "GET_ALL"); | ||
736 | #endif | ||
711 | send_to_each_host (NULL, ntohl (lpm->trust_change), client); | 737 | send_to_each_host (NULL, ntohl (lpm->trust_change), client); |
712 | } | 738 | } |
713 | 739 | ||
@@ -727,6 +753,11 @@ handle_notify (void *cls, | |||
727 | struct InfoMessage *msg; | 753 | struct InfoMessage *msg; |
728 | struct HostEntry *pos; | 754 | struct HostEntry *pos; |
729 | 755 | ||
756 | #if DEBUG_PEERINFO | ||
757 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
758 | "`%s' message received\n", | ||
759 | "NOTIFY"); | ||
760 | #endif | ||
730 | GNUNET_SERVER_notification_context_add (notify_list, | 761 | GNUNET_SERVER_notification_context_add (notify_list, |
731 | client); | 762 | client); |
732 | pos = hosts; | 763 | pos = hosts; |