aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-gns-benchmark.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/gnunet-gns-benchmark.c')
-rw-r--r--src/gns/gnunet-gns-benchmark.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/gns/gnunet-gns-benchmark.c b/src/gns/gnunet-gns-benchmark.c
index d5afae9f66..0ab6cefd53 100644
--- a/src/gns/gnunet-gns-benchmark.c
+++ b/src/gns/gnunet-gns-benchmark.c
@@ -84,7 +84,7 @@ struct Request
* this struct (optimizing memory consumption by reducing
* total number of allocations).
*/
- char *hostname;
+ const char *hostname;
/**
* While we are fetching the record, the value is set to the
@@ -176,6 +176,11 @@ static struct GNUNET_TIME_Relative request_delay;
*/
static struct GNUNET_TIME_Relative timeout;
+/**
+ * Number of requests we have concurrently active.
+ */
+static unsigned int active_cnt;
+
/**
* Free @a req and data structures reachable from it.
@@ -210,6 +215,10 @@ process_result (void *cls,
(void) gns_tld;
(void) rd_count;
(void) rd;
+ active_cnt--;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Got response for request `%s'\n",
+ req->hostname);
req->lr = NULL;
req->latency = GNUNET_TIME_absolute_get_duration (req->op_start_time);
GNUNET_CONTAINER_DLL_remove (act_head,
@@ -247,7 +256,11 @@ process_queue (void *cls)
GNUNET_CONTAINER_DLL_remove (act_head,
act_tail,
req);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Failing request `%s' due to timeout\n",
+ req->hostname);
failures[req->cat]++;
+ active_cnt--;
free_request (req);
}
if (NULL == (req = todo_head))
@@ -273,7 +286,12 @@ process_queue (void *cls)
act_tail,
req);
lookups[req->cat]++;
+ active_cnt++;
req->op_start_time = GNUNET_TIME_absolute_get ();
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Starting request `%s' (%u in parallel)\n",
+ req->hostname,
+ active_cnt);
req->lr = GNUNET_GNS_lookup_with_tld (gns,
req->hostname,
GNUNET_GNSRECORD_TYPE_ANY,
@@ -439,7 +457,7 @@ queue (const char *hostname,
req = GNUNET_malloc (sizeof (struct Request) + hlen);
req->cat = cat;
req->hostname = (char *) &req[1];
- GNUNET_memcpy (req->hostname,
+ GNUNET_memcpy (&req[1],
hostname,
hlen);
GNUNET_CONTAINER_DLL_insert (todo_head,