From 6d5f2d7b3d3daefada86869e8a4b2930f80b7ee3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 14 Nov 2012 15:53:47 +0000 Subject: [PATCH] fixing crash of mesh service -- reproduced by regex profiler w 100 peers -- on shutdown due to failure to initialize dht_handle field --- src/dht/dht_api.c | 1 + src/dht/gnunet-service-dht_clients.c | 23 +++++++++++++++++++++++ src/dht/gnunet-service-dht_neighbours.c | 15 +++++++++++---- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index f46900778..0e709a83f 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c @@ -1268,6 +1268,7 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, pending); pending->in_pending_queue = GNUNET_YES; get_handle = GNUNET_malloc (sizeof (struct GNUNET_DHT_GetHandle)); + get_handle->dht_handle = handle; get_handle->iter = iter; get_handle->iter_cls = iter_cls; get_handle->message = pending; diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c index 85cdf8252..0e309e59e 100644 --- a/src/dht/gnunet-service-dht_clients.c +++ b/src/dht/gnunet-service-dht_clients.c @@ -36,6 +36,12 @@ #include "dht.h" +/** + * Should routing details be logged to stderr (for debugging)? + */ +#define LOG_ROUTE_DETAILS_STDERR GNUNET_YES + + /** * Linked list of messages to send to clients. */ @@ -581,6 +587,16 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received request for %s from local client %p\n", GNUNET_h2s (&get->key), client); + + if (LOG_ROUTE_DETAILS_STDERR) + { + fprintf (stderr, + "XDHT CLIENT-GET %s @ %u\n", + GNUNET_h2s (&get->key), + getpid ()); + } + + cqr = GNUNET_malloc (sizeof (struct ClientQueryRecord) + xquery_size); cqr->key = get->key; cqr->client = find_active_client (client); @@ -1002,6 +1018,13 @@ forward_reply (void *cls, const struct GNUNET_HashCode * key, void *value) struct GNUNET_HashCode ch; unsigned int i; + if (LOG_ROUTE_DETAILS_STDERR) + { + fprintf (stderr, + "XDHT CLIENT-RESULT %s @ %u\n", + GNUNET_h2s (key), + getpid ()); + } if ((record->type != GNUNET_BLOCK_TYPE_ANY) && (record->type != frc->type)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 5d11e55ae..ea4baa9e9 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -97,7 +97,7 @@ /** * Should routing details be logged to stderr (for debugging)? */ -#define LOG_ROUTE_DETAILS_STDERR GNUNET_NO +#define LOG_ROUTE_DETAILS_STDERR GNUNET_YES GNUNET_NETWORK_STRUCT_BEGIN @@ -1598,7 +1598,9 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, char *tmp; tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); - fprintf (stderr, "XDHT PUT %s: %s<-%s\n", GNUNET_h2s (&put->key), tmp, GNUNET_i2s (peer)); + fprintf (stderr, "XDHT PUT %s: %s(%u)<-%s\n", + GNUNET_h2s (&put->key), tmp, getpid (), + GNUNET_i2s (peer)); GNUNET_free (tmp); } @@ -1855,7 +1857,9 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, char *tmp; tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); - fprintf (stderr, "XDHT GET %s: %s<-%s\n", GNUNET_h2s (&get->key), tmp, GNUNET_i2s (peer)); + fprintf (stderr, "XDHT GET %s: %s(%u)<-%s\n", + GNUNET_h2s (&get->key), tmp, getpid(), + GNUNET_i2s (peer)); GNUNET_free (tmp); } @@ -1989,7 +1993,10 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer, char *tmp; tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); - fprintf (stderr, "XDHT RESULT %s: %s<-%s\n", GNUNET_h2s (&prm->key), tmp, GNUNET_i2s (peer)); + fprintf (stderr, + "XDHT RESULT %s: %s(%u)<-%s\n", + GNUNET_h2s (&prm->key), tmp, + getpid(), GNUNET_i2s (peer)); GNUNET_free (tmp); } -- 2.25.1