diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-26 09:23:21 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-26 09:23:21 +0000 |
commit | 9b2443128365ac573910671487ac2d2e5e7e7eab (patch) | |
tree | 33f971115978f51e0d4aef615ea1f8c71686ace4 /src | |
parent | b95384b49374152842c204270ff24de8cad3169b (diff) | |
download | gnunet-9b2443128365ac573910671487ac2d2e5e7e7eab.tar.gz gnunet-9b2443128365ac573910671487ac2d2e5e7e7eab.zip |
-more logging, minor code cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 42 | ||||
-rw-r--r-- | src/namestore/namestore_api.c | 8 |
2 files changed, 39 insertions, 11 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 3bd63ca08..f1b40f206 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -727,7 +727,10 @@ dns_result_parser (void *cls, | |||
727 | GNS_resolver_lookup_cancel (rh); | 727 | GNS_resolver_lookup_cancel (rh); |
728 | return; | 728 | return; |
729 | } | 729 | } |
730 | 730 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |
731 | "Received DNS response for `%s' with %u answers\n", | ||
732 | rh->ac_tail->label, | ||
733 | (unsigned int) p->num_answers); | ||
731 | if ( (p->num_answers > 0) && | 734 | if ( (p->num_answers > 0) && |
732 | (GNUNET_DNSPARSER_TYPE_CNAME == p->answers[0].type) && | 735 | (GNUNET_DNSPARSER_TYPE_CNAME == p->answers[0].type) && |
733 | (GNUNET_DNSPARSER_TYPE_CNAME != rh->record_type) ) | 736 | (GNUNET_DNSPARSER_TYPE_CNAME != rh->record_type) ) |
@@ -881,6 +884,9 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh) | |||
881 | 884 | ||
882 | ac = rh->ac_tail; | 885 | ac = rh->ac_tail; |
883 | GNUNET_assert (NULL != ac); | 886 | GNUNET_assert (NULL != ac); |
887 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
888 | "Starting DNS lookup for `%s'\n", | ||
889 | ac->label); | ||
884 | GNUNET_assert (GNUNET_NO == ac->gns_authority); | 890 | GNUNET_assert (GNUNET_NO == ac->gns_authority); |
885 | switch (((const struct sockaddr *) &ac->authority_info.dns_authority.dns_ip)->sa_family) | 891 | switch (((const struct sockaddr *) &ac->authority_info.dns_authority.dns_ip)->sa_family) |
886 | { | 892 | { |
@@ -1078,7 +1084,7 @@ vpn_allocation_cb (void *cls, | |||
1078 | /** | 1084 | /** |
1079 | * Process a records that were decrypted from a block. | 1085 | * Process a records that were decrypted from a block. |
1080 | * | 1086 | * |
1081 | * @param cls closure with the 'struct GNS_ResolverHandle' | 1087 | * @param cls closure with the `struct GNS_ResolverHandle` |
1082 | * @param rd_count number of entries in @a rd array | 1088 | * @param rd_count number of entries in @a rd array |
1083 | * @param rd array of records with data to store | 1089 | * @param rd array of records with data to store |
1084 | */ | 1090 | */ |
@@ -1107,7 +1113,12 @@ handle_gns_resolution_result (void *cls, | |||
1107 | size_t off; | 1113 | size_t off; |
1108 | struct GNUNET_NAMESTORE_RecordData rd_new[rd_count]; | 1114 | struct GNUNET_NAMESTORE_RecordData rd_new[rd_count]; |
1109 | unsigned int rd_off; | 1115 | unsigned int rd_off; |
1110 | 1116 | ||
1117 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1118 | "Resolution succeeded for `%s' in zone %s, got %u records\n", | ||
1119 | rh->ac_tail->label, | ||
1120 | GNUNET_NAMESTORE_z2s (&rh->ac_tail->authority_info.gns_authority), | ||
1121 | rd_count); | ||
1111 | if (0 == rh->name_resolution_pos) | 1122 | if (0 == rh->name_resolution_pos) |
1112 | { | 1123 | { |
1113 | /* top-level match, are we done yet? */ | 1124 | /* top-level match, are we done yet? */ |
@@ -1600,7 +1611,7 @@ namestore_cache_continuation (void *cls, | |||
1600 | * @param get_path_length number of entries in @a get_path | 1611 | * @param get_path_length number of entries in @a get_path |
1601 | * @param put_path peers on the PUT path (or NULL if not recorded) | 1612 | * @param put_path peers on the PUT path (or NULL if not recorded) |
1602 | * [0] = origin, [length - 1] = datastore | 1613 | * [0] = origin, [length - 1] = datastore |
1603 | * @param put_path_length number of entries in @a get_path | 1614 | * @param put_path_length number of entries in @a put_path |
1604 | * @param type type of the result | 1615 | * @param type type of the result |
1605 | * @param size number of bytes in data | 1616 | * @param size number of bytes in data |
1606 | * @param data pointer to the result data | 1617 | * @param data pointer to the result data |
@@ -1690,6 +1701,10 @@ handle_namestore_block_response (void *cls, | |||
1690 | (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (block->expiration_time)).rel_value_us) ) ) | 1701 | (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (block->expiration_time)).rel_value_us) ) ) |
1691 | { | 1702 | { |
1692 | /* Namestore knows nothing; try DHT lookup */ | 1703 | /* Namestore knows nothing; try DHT lookup */ |
1704 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1705 | "Starting DHT lookup for `%s' in zone %s\n", | ||
1706 | ac->label, | ||
1707 | GNUNET_NAMESTORE_z2s (&ac->authority_info.gns_authority)); | ||
1693 | rh->get_handle = GNUNET_DHT_get_start (dht_handle, | 1708 | rh->get_handle = GNUNET_DHT_get_start (dht_handle, |
1694 | GNUNET_BLOCK_TYPE_GNS_NAMERECORD, | 1709 | GNUNET_BLOCK_TYPE_GNS_NAMERECORD, |
1695 | &query, | 1710 | &query, |
@@ -1714,6 +1729,10 @@ handle_namestore_block_response (void *cls, | |||
1714 | (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (block->expiration_time)).rel_value_us) ) | 1729 | (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (block->expiration_time)).rel_value_us) ) |
1715 | { | 1730 | { |
1716 | /* DHT not permitted and no local result, fail */ | 1731 | /* DHT not permitted and no local result, fail */ |
1732 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1733 | "Resolution failed for `%s' in zone %s (DHT lookup not permitted by configuration)\n", | ||
1734 | ac->label, | ||
1735 | GNUNET_NAMESTORE_z2s (&ac->authority_info.gns_authority)); | ||
1717 | rh->proc (rh->proc_cls, 0, NULL); | 1736 | rh->proc (rh->proc_cls, 0, NULL); |
1718 | GNS_resolver_lookup_cancel (rh); | 1737 | GNS_resolver_lookup_cancel (rh); |
1719 | return; | 1738 | return; |
@@ -1744,6 +1763,10 @@ recursive_gns_resolution_namestore (struct GNS_ResolverHandle *rh) | |||
1744 | struct AuthorityChain *ac = rh->ac_tail; | 1763 | struct AuthorityChain *ac = rh->ac_tail; |
1745 | struct GNUNET_HashCode query; | 1764 | struct GNUNET_HashCode query; |
1746 | 1765 | ||
1766 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1767 | "Starting GNS resolution for `%s' in zone %s\n", | ||
1768 | ac->label, | ||
1769 | GNUNET_NAMESTORE_z2s (&ac->authority_info.gns_authority)); | ||
1747 | GNUNET_NAMESTORE_query_from_public_key (&ac->authority_info.gns_authority, | 1770 | GNUNET_NAMESTORE_query_from_public_key (&ac->authority_info.gns_authority, |
1748 | ac->label, | 1771 | ac->label, |
1749 | &query); | 1772 | &query); |
@@ -1776,10 +1799,10 @@ recursive_resolution (void *cls, | |||
1776 | GNS_resolver_lookup_cancel (rh); | 1799 | GNS_resolver_lookup_cancel (rh); |
1777 | return; | 1800 | return; |
1778 | } | 1801 | } |
1779 | if (GNUNET_YES == rh->ac_tail->gns_authority) | 1802 | if (GNUNET_YES == rh->ac_tail->gns_authority) |
1780 | recursive_gns_resolution_namestore (rh); | 1803 | recursive_gns_resolution_namestore (rh); |
1781 | else | 1804 | else |
1782 | recursive_dns_resolution (rh); | 1805 | recursive_dns_resolution (rh); |
1783 | } | 1806 | } |
1784 | 1807 | ||
1785 | 1808 | ||
@@ -1897,6 +1920,9 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicSignKey *zone, | |||
1897 | { | 1920 | { |
1898 | struct GNS_ResolverHandle *rh; | 1921 | struct GNS_ResolverHandle *rh; |
1899 | 1922 | ||
1923 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1924 | "Starting lookup for `%s'\n", | ||
1925 | name); | ||
1900 | rh = GNUNET_new (struct GNS_ResolverHandle); | 1926 | rh = GNUNET_new (struct GNS_ResolverHandle); |
1901 | GNUNET_CONTAINER_DLL_insert (rlh_head, | 1927 | GNUNET_CONTAINER_DLL_insert (rlh_head, |
1902 | rlh_tail, | 1928 | rlh_tail, |
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index ff1630b92..946dd91c7 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -345,7 +345,8 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
345 | int res; | 345 | int res; |
346 | const char *emsg; | 346 | const char *emsg; |
347 | 347 | ||
348 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received `%s'\n", | 348 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
349 | "Received `%s'\n", | ||
349 | "RECORD_STORE_RESPONSE"); | 350 | "RECORD_STORE_RESPONSE"); |
350 | /* TODO: add actual error message from namestore to response... */ | 351 | /* TODO: add actual error message from namestore to response... */ |
351 | res = ntohl (msg->op_result); | 352 | res = ntohl (msg->op_result); |
@@ -1081,8 +1082,9 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, | |||
1081 | GNUNET_break (rd_ser_len == GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_ser)); | 1082 | GNUNET_break (rd_ser_len == GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_ser)); |
1082 | 1083 | ||
1083 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1084 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1084 | "Sending `%s' message for name `%s' with size %u\n", | 1085 | "Sending `%s' message for name `%s' with size %u and %u records\n", |
1085 | "NAMESTORE_RECORD_STORE", label, msg_size); | 1086 | "NAMESTORE_RECORD_STORE", label, msg_size, |
1087 | rd_count); | ||
1086 | GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); | 1088 | GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); |
1087 | do_transmit(h); | 1089 | do_transmit(h); |
1088 | return qe; | 1090 | return qe; |