From: Christian Grothoff Date: Tue, 16 Mar 2010 09:00:33 +0000 (+0000) Subject: logging X-Git-Tag: initial-import-from-subversion-38251~22455 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=aea1ff2765ee7f6ba2317e4f68693094effb448d;p=oweals%2Fgnunet.git logging --- diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c index 381638554..99b43f008 100644 --- a/src/hostlist/hostlist-client.c +++ b/src/hostlist/hostlist-client.c @@ -159,7 +159,10 @@ download_hostlist_processor (void *ptr, download_pos += cpy; left -= cpy; if (download_pos < sizeof(struct GNUNET_MessageHeader)) - break; + { + GNUNET_assert (left == 0); + break; + } msg = (const struct GNUNET_MessageHeader *) download_buffer; msize = ntohs(msg->size); if (msize < sizeof(struct GNUNET_MessageHeader)) @@ -176,7 +179,10 @@ download_hostlist_processor (void *ptr, return total; } if (download_pos < msize) - break; + { + GNUNET_assert (left == 0); + break; + } if (GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message*)msg) == msize) { #if DEBUG_HOSTLIST_CLIENT @@ -200,7 +206,7 @@ download_hostlist_processor (void *ptr, _("Invalid `%s' message received from hostlist at `%s'\n"), "HELLO", current_url); - bogus_url = 1; + bogus_url = GNUNET_YES; return total; } memmove (download_buffer, diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index 0982889d7..9583d6a4f 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c @@ -179,7 +179,17 @@ host_processor (void *cls, GNUNET_i2s (peer)); #endif if (old + s >= GNUNET_MAX_MALLOC_CHECKED) - return; /* too large, skip! */ + { + GNUNET_STATISTICS_update (stats, + gettext_noop("bytes not included in hostlist (size limit)"), + s, + GNUNET_NO); + return; /* too large, skip! */ + } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Adding peer `%s' to hostlist (%u bytes)\n", + GNUNET_i2s (peer), + (unsigned int) s); GNUNET_array_grow (results->data, results->size, old + s);