[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17742 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17742 - gnunet/src/dht |
Date: |
Tue, 25 Oct 2011 14:57:18 +0200 |
Author: grothoff
Date: 2011-10-25 14:57:18 +0200 (Tue, 25 Oct 2011)
New Revision: 17742
Modified:
gnunet/src/dht/dht_api.c
gnunet/src/dht/gnunet-service-dht.h
gnunet/src/dht/gnunet-service-dht_clients.c
gnunet/src/dht/gnunet-service-dht_datacache.c
gnunet/src/dht/gnunet-service-dht_neighbours.c
Log:
put ifdefs around DEBUG logs
Modified: gnunet/src/dht/dht_api.c
===================================================================
--- gnunet/src/dht/dht_api.c 2011-10-25 12:36:52 UTC (rev 17741)
+++ gnunet/src/dht/dht_api.c 2011-10-25 12:57:18 UTC (rev 17742)
@@ -250,10 +250,12 @@
if (GNUNET_NO == rh->message->in_pending_queue)
{
+#if DEBUG_DHT
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Retransmitting request related to %s to DHT %p\n",
GNUNET_h2s (key),
handle);
+#endif
GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
rh->message);
rh->message->in_pending_queue = GNUNET_YES;
@@ -281,9 +283,11 @@
{
struct GNUNET_DHT_Handle *handle = cls;
+#if DEBUG_DHT
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Reconnecting with DHT %p\n",
handle);
+#endif
handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
if (handle->retry_time.rel_value < GNUNET_CONSTANTS_SERVICE_RETRY.rel_value)
handle->retry_time = GNUNET_CONSTANTS_SERVICE_RETRY;
@@ -294,7 +298,9 @@
handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
if (GNUNET_YES != try_connect (handle))
{
+#if DEBUG_DHT
LOG (GNUNET_ERROR_TYPE_DEBUG, "dht reconnect failed(!)\n");
+#endif
return;
}
GNUNET_CONTAINER_multihashmap_iterate (handle->active_requests,
@@ -380,8 +386,10 @@
handle->th = NULL;
if (buf == NULL)
{
+#if DEBUG_DHT
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Transmission to DHT service failed! Reconnecting!\n");
+#endif
do_disconnect (handle);
return 0;
}
@@ -457,10 +465,12 @@
if (dht_msg->unique_id != get_handle->unique_id)
{
/* UID mismatch */
+#if DEBUG_DHT
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Ignoring reply for %s: UID mismatch: %llu/%llu\n",
GNUNET_h2s (key),
dht_msg->unique_id, get_handle->unique_id);
+#endif
return GNUNET_YES;
}
msize = ntohs (dht_msg->header.size);
@@ -479,10 +489,12 @@
return GNUNET_NO;
}
data_length = msize - meta_length;
+#if DEBUG_DHT
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Giving %u byte reply for %s to application\n",
(unsigned int) data_length,
GNUNET_h2s (key));
+#endif
put_path = (const struct GNUNET_PeerIdentity *) &dht_msg[1];
get_path = &put_path[put_path_length];
data = &get_path[get_path_length];
@@ -509,8 +521,10 @@
if (msg == NULL)
{
+#if DEBUG_DHT
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Error receiving data from DHT service, reconnecting\n");
+#endif
do_disconnect (handle);
return;
}
@@ -527,10 +541,12 @@
return;
}
dht_msg = (const struct GNUNET_DHT_ClientResultMessage *) msg;
+#if DEBUG_DHT
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received reply for `%s' from DHT service %p\n",
GNUNET_h2s (&dht_msg->key),
handle);
+#endif
GNUNET_CONTAINER_multihashmap_get_multiple (handle->active_requests,
&dht_msg->key, &process_reply,
(void *) dht_msg);
@@ -735,10 +751,12 @@
GNUNET_break (0);
return NULL;
}
+#if DEBUG_DHT
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Sending query for %s to DHT %p\n",
GNUNET_h2s (key),
handle);
+#endif
pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
get_msg = (struct GNUNET_DHT_ClientGetMessage *) &pending[1];
pending->msg = &get_msg->header;
@@ -784,10 +802,12 @@
handle = get_handle->message->handle;
get_msg =
(const struct GNUNET_DHT_ClientGetMessage *) get_handle->message->msg;
+#if DEBUG_DHT
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Sending STOP for %s to DHT via %p\n",
GNUNET_h2s (&get_msg->key),
handle);
+#endif
/* generate STOP */
pending =
GNUNET_malloc (sizeof (struct PendingMessage) +
Modified: gnunet/src/dht/gnunet-service-dht.h
===================================================================
--- gnunet/src/dht/gnunet-service-dht.h 2011-10-25 12:36:52 UTC (rev 17741)
+++ gnunet/src/dht/gnunet-service-dht.h 2011-10-25 12:57:18 UTC (rev 17742)
@@ -30,6 +30,8 @@
#include "gnunet_statistics_service.h"
#include "gnunet_transport_service.h"
+#define DEBUG_DHT GNUNET_EXTRA_LOGGING
+
/**
* Configuration we use.
*/
Modified: gnunet/src/dht/gnunet-service-dht_clients.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_clients.c 2011-10-25 12:36:52 UTC (rev
17741)
+++ gnunet/src/dht/gnunet-service-dht_clients.c 2011-10-25 12:57:18 UTC (rev
17742)
@@ -248,10 +248,12 @@
if (record->client != client)
return GNUNET_YES;
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Removing client %p's record for key %s\n",
client,
GNUNET_h2s (key));
+#endif
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (forward_map,
key, record));
@@ -280,9 +282,11 @@
struct ClientList *pos;
struct PendingMessage *reply;
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Local client %p disconnects\n",
client);
+#endif
pos = find_active_client (client);
GNUNET_CONTAINER_DLL_remove (client_head,
client_tail,
@@ -410,10 +414,12 @@
GNUNET_NO);
dht_msg = (const struct GNUNET_DHT_ClientPutMessage *) message;
/* give to local clients */
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Handling local PUT of %u-bytes for query %s\n",
size - sizeof (struct GNUNET_DHT_ClientPutMessage),
GNUNET_h2s (&dht_msg->key));
+#endif
GDS_CLIENTS_handle_reply (GNUNET_TIME_absolute_ntoh (dht_msg->expiration),
&dht_msg->key,
0, NULL,
@@ -479,10 +485,12 @@
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# GET requests received from
clients"), 1,
GNUNET_NO);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received request for %s from local client %p\n",
GNUNET_h2s (&get->key),
client);
+#endif
cqr = GNUNET_malloc (sizeof (struct ClientQueryRecord) + xquery_size);
cqr->key = get->key;
cqr->client = find_active_client (client);
@@ -546,10 +554,12 @@
if (record->unique_id != ctx->unique_id)
return GNUNET_YES;
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Removing client %p's record for key %s (by unique id)\n",
ctx->client->client_handle,
GNUNET_h2s (key));
+#endif
return remove_client_records (ctx->client, key, record);
}
@@ -574,10 +584,12 @@
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# GET STOP requests received from
clients"), 1,
GNUNET_NO);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Client %p stopped request for key %s\n",
client,
GNUNET_h2s (&dht_stop_msg->key));
+#endif
ctx.client = find_active_client (client);
ctx.unique_id = dht_stop_msg->unique_id;
GNUNET_CONTAINER_multihashmap_get_multiple (forward_map,
@@ -622,9 +634,11 @@
if (buf == NULL)
{
/* client disconnected */
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Client %p disconnected, pending messages will be discarded\n",
client->client_handle);
+#endif
return 0;
}
off = 0;
@@ -635,18 +649,22 @@
reply);
memcpy (&cbuf[off], reply->msg, msize);
GNUNET_free (reply);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmitting %u bytes to client %p\n",
msize,
client->client_handle);
+#endif
off += msize;
}
process_pending_messages (client);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmitted %u/%u bytes to client %p\n",
(unsigned int) off,
(unsigned int) size,
client->client_handle);
+#endif
return off;
}
@@ -661,19 +679,23 @@
{
if ((client->pending_head == NULL) || (client->transmit_handle != NULL))
{
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Not asking for transmission to %p now: %s\n",
client->client_handle,
client->pending_head == NULL
? "no more messages"
: "request already pending");
+#endif
return;
}
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asking for transmission of %u bytes to client %p\n",
ntohs (client->pending_head->
msg->size),
client->client_handle);
+#endif
client->transmit_handle =
GNUNET_SERVER_notify_transmit_ready (client->client_handle,
ntohs (client->pending_head->
@@ -759,9 +781,11 @@
if ( (record->type != GNUNET_BLOCK_TYPE_ANY) &&
(record->type != frc->type) )
{
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Record type missmatch, not passing request for key %s to
local client\n",
GNUNET_h2s (key));
+#endif
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# Key match, type mismatches in
REPLY to CLIENT"), 1,
GNUNET_NO);
@@ -775,9 +799,11 @@
&ch,
sizeof (GNUNET_HashCode)))
{
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Duplicate reply, not passing request for key %s to local
client\n",
GNUNET_h2s (key));
+#endif
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# Duplicate REPLIES to CLIENT
request dropped"), 1,
GNUNET_NO);
@@ -791,10 +817,12 @@
record->xquery_size,
frc->data,
frc->data_size);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Evaluation result is %d for key %s for local client's query\n",
(int) eval,
GNUNET_h2s (key));
+#endif
switch (eval)
{
case GNUNET_BLOCK_EVALUATION_OK_LAST:
@@ -848,10 +876,12 @@
GNUNET_NO);
reply = (struct GNUNET_DHT_ClientResultMessage*) &pm[1];
reply->unique_id = record->unique_id;
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Queueing reply to query %s for client %p\n",
GNUNET_h2s (key),
record->client->client_handle);
+#endif
add_pending_message (record->client, pm);
if (GNUNET_YES == do_free)
remove_client_records (record->client, key, record);
Modified: gnunet/src/dht/gnunet-service-dht_datacache.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_datacache.c 2011-10-25 12:36:52 UTC
(rev 17741)
+++ gnunet/src/dht/gnunet-service-dht_datacache.c 2011-10-25 12:57:18 UTC
(rev 17742)
@@ -89,7 +89,7 @@
if (datacache == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "%s request received, but have no datacache!\n",
+ _("%s request received, but have no datacache!\n"),
"PUT");
return;
}
@@ -199,10 +199,12 @@
ctx->xquery_size,
rdata,
rdata_size);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Found reply for query %s in datacache, evaluation result is
%d\n",
GNUNET_h2s (key),
(int) eval);
+#endif
ctx->eval = eval;
switch (eval)
{
@@ -243,7 +245,7 @@
gettext_noop ("# Unsupported RESULTS found in
datacache"), 1,
GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Unsupported block type (%u) in local response!\n",
+ _("Unsupported block type (%u) in local response!\n"),
type);
break;
}
Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c 2011-10-25 12:36:52 UTC
(rev 17741)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c 2011-10-25 12:57:18 UTC
(rev 17742)
@@ -523,10 +523,12 @@
GNUNET_HashCode mh;
GNUNET_BLOCK_mingle_hash (key, ctx->bf_mutator, &mh);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding known peer (%s) to bloomfilter for FIND PEER with
mutation %u\n",
GNUNET_h2s (key),
ctx->bf_mutator);
+#endif
GNUNET_CONTAINER_bloomfilter_add (ctx->bloom, &mh);
return GNUNET_YES;
}
@@ -613,10 +615,12 @@
/* Check for connect to self message */
if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
return;
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Connected %s to %s\n",
GNUNET_i2s (&my_identity),
GNUNET_h2s (&peer->hashPubKey));
+#endif
if (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_contains (all_known_peers,
&peer->hashPubKey))
@@ -676,10 +680,12 @@
/* Check for disconnect from self message */
if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
return;
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Disconnected %s from %s\n",
GNUNET_i2s (&my_identity),
GNUNET_h2s (&peer->hashPubKey));
+#endif
to_remove =
GNUNET_CONTAINER_multihashmap_get (all_known_peers, &peer->hashPubKey);
if (NULL == to_remove)
@@ -1035,10 +1041,12 @@
}
else
{
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Excluded peer `%s' due to BF match in greedy routing for
%s\n",
GNUNET_i2s (&pos->id),
GNUNET_h2s (key));
+#endif
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# Peers excluded from
routing due to Bloomfilter"), 1,
GNUNET_NO);
@@ -1069,10 +1077,12 @@
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# Peers excluded from routing
due to Bloomfilter"), 1,
GNUNET_NO);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Excluded peer `%s' due to BF match in random routing for
%s\n",
GNUNET_i2s (&pos->id),
GNUNET_h2s (key));
+#endif
pos = pos->next;
continue; /* Ignore bloomfiltered peers */
}
@@ -1155,6 +1165,7 @@
GNUNET_CONTAINER_bloomfilter_test (bloom,
&nxt->id.hashPubKey));
GNUNET_CONTAINER_bloomfilter_add (bloom, &rtargets[off]->id.hashPubKey);
}
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Selected %u/%u peers at hop %u for %s (target was %u)\n",
off,
@@ -1162,6 +1173,7 @@
(unsigned int) hop_count,
GNUNET_h2s (key),
ret);
+#endif
if (0 == off)
{
GNUNET_free (rtargets);
@@ -1215,10 +1227,12 @@
struct GNUNET_PeerIdentity *pp;
GNUNET_assert (NULL != bf);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding myself (%s) to PUT bloomfilter for %s\n",
GNUNET_i2s (&my_identity),
GNUNET_h2s (key));
+#endif
GNUNET_CONTAINER_bloomfilter_add (bf, &my_identity.hashPubKey);
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# PUT requests routed"), 1,
@@ -1228,11 +1242,13 @@
&targets);
if (0 == target_count)
{
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Routing PUT for %s terminates after %u hops at %s\n",
GNUNET_h2s (key),
(unsigned int) hop_count,
GNUNET_i2s (&my_identity));
+#endif
return;
}
msize = put_path_length * sizeof (struct GNUNET_PeerIdentity) + data_size +
sizeof (struct PeerPutMessage);
@@ -1253,11 +1269,13 @@
for (i=0;i<target_count;i++)
{
target = targets[i];
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Routing PUT for %s after %u hops to %s\n",
GNUNET_h2s (key),
(unsigned int) hop_count,
GNUNET_i2s (&target->id));
+#endif
pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize);
pending->importance = 0; /* FIXME */
pending->timeout = expiration_time;
@@ -1336,20 +1354,24 @@
target_count = get_target_peers (key, peer_bf, hop_count,
desired_replication_level,
&targets);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding myself (%s) to GET bloomfilter for %s\n",
GNUNET_i2s (&my_identity),
GNUNET_h2s (key));
+#endif
GNUNET_CONTAINER_bloomfilter_add (peer_bf, &my_identity.hashPubKey);
if (0 == target_count)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Routing GET for %s terminates after %u hops at %s\n",
- GNUNET_h2s (key),
- (unsigned int) hop_count,
- GNUNET_i2s (&my_identity));
- return;
- }
+ {
+#if DEBUG_DHT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Routing GET for %s terminates after %u hops at %s\n",
+ GNUNET_h2s (key),
+ (unsigned int) hop_count,
+ GNUNET_i2s (&my_identity));
+#endif
+ return;
+ }
reply_bf_size = GNUNET_CONTAINER_bloomfilter_get_size (reply_bf);
msize = xquery_size + sizeof (struct PeerGetMessage) + reply_bf_size;
if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
@@ -1365,11 +1387,13 @@
for (i=0;i<target_count;i++)
{
target = targets[i];
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Routing GET for %s after %u hops to %s\n",
GNUNET_h2s (key),
(unsigned int) hop_count,
GNUNET_i2s (&target->id));
+#endif
pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize);
pending->importance = 0; /* FIXME */
pending->timeout = GNUNET_TIME_relative_to_absolute (GET_TIMEOUT);
@@ -1573,10 +1597,12 @@
/* cannot verify, good luck */
break;
}
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"PUT for %s at %s\n",
GNUNET_h2s (&put->key),
GNUNET_i2s (&my_identity));
+#endif
bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter,
DHT_BLOOM_SIZE,
GNUNET_CONSTANTS_BLOOMFILTER_K);
@@ -1809,11 +1835,13 @@
&get->key,
xquery, xquery_size,
reply_bf, get->bf_mutator);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"GET for %s at %s after %u hops\n",
GNUNET_h2s (&get->key),
GNUNET_i2s (&my_identity),
(unsigned int) ntohl (get->hop_count));
+#endif
/* local lookup (this may update the reply_bf) */
if ( (0 != (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE)) ||
(am_closest_peer (&get->key,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17742 - gnunet/src/dht,
gnunet <=