[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16849 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16849 - gnunet/src/dht |
Date: |
Wed, 14 Sep 2011 17:55:43 +0200 |
Author: bartpolot
Date: 2011-09-14 17:55:43 +0200 (Wed, 14 Sep 2011)
New Revision: 16849
Modified:
gnunet/src/dht/gnunet-service-dht.c
Log:
Change datacache_get_iterator to use stack instead of heap
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2011-09-14 15:48:10 UTC (rev 16848)
+++ gnunet/src/dht/gnunet-service-dht.c 2011-09-14 15:55:43 UTC (rev 16849)
@@ -2068,7 +2068,7 @@
const char *data, enum GNUNET_BLOCK_Type type)
{
struct DHT_MessageContext *msg_ctx = cls;
- struct DHT_MessageContext *new_msg_ctx;
+ struct DHT_MessageContext new_msg_ctx;
struct GNUNET_DHT_GetResultMessage *get_result;
enum GNUNET_BLOCK_EvaluationResult eval;
const struct DHTPutEntry *put_entry;
@@ -2112,20 +2112,16 @@
case GNUNET_BLOCK_EVALUATION_OK_LAST:
msg_ctx->do_forward = GNUNET_NO;
case GNUNET_BLOCK_EVALUATION_OK_MORE:
- new_msg_ctx = GNUNET_malloc (sizeof (struct DHT_MessageContext));
- memcpy (new_msg_ctx, msg_ctx, sizeof (struct DHT_MessageContext));
+ memcpy (&new_msg_ctx, msg_ctx, sizeof (struct DHT_MessageContext));
if (GNUNET_DHT_RO_RECORD_ROUTE ==
(msg_ctx->msg_options & GNUNET_DHT_RO_RECORD_ROUTE))
{
- new_msg_ctx->msg_options = GNUNET_DHT_RO_RECORD_ROUTE;
- new_msg_ctx->path_history_len = msg_ctx->path_history_len;
- /* Assign to previous msg_ctx path history, caller should free after our
return */
- new_msg_ctx->path_history = msg_ctx->path_history;
+ new_msg_ctx.msg_options = GNUNET_DHT_RO_RECORD_ROUTE;
#if DEBUG_PATH
- for (i = 0; i < new_msg_ctx->path_history_len; i++)
+ for (i = 0; i < new_msg_ctx.path_history_len; i++)
{
path_offset =
- &new_msg_ctx->path_history[i * sizeof (struct
GNUNET_PeerIdentity)];
+ &new_msg_ctx.path_history[i * sizeof (struct GNUNET_PeerIdentity)];
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"(get_iterator) Key %s Found peer %d:%s\n",
GNUNET_h2s (&msg_ctx->key), i,
@@ -2161,15 +2157,13 @@
memcpy (&get_result[1], &put_entry[1],
put_entry->data_size +
(put_entry->path_length * sizeof (struct GNUNET_PeerIdentity)));
- new_msg_ctx->peer = &my_identity;
- new_msg_ctx->bloom =
- GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, DHT_BLOOM_K);
- new_msg_ctx->hop_count = 0;
- new_msg_ctx->importance = DHT_DEFAULT_P2P_IMPORTANCE + 2; /* Make result
routing a higher priority */
- new_msg_ctx->timeout = DHT_DEFAULT_P2P_TIMEOUT;
+ new_msg_ctx.peer = &my_identity;
+ new_msg_ctx.bloom = NULL;
+ new_msg_ctx.hop_count = 0;
+ new_msg_ctx.importance = DHT_DEFAULT_P2P_IMPORTANCE + 2; /* Make result
routing a higher priority */
+ new_msg_ctx.timeout = DHT_DEFAULT_P2P_TIMEOUT;
increment_stats (STAT_GET_RESPONSE_START);
- route_result_message (&get_result->header, new_msg_ctx);
- GNUNET_free (new_msg_ctx);
+ route_result_message (&get_result->header, &new_msg_ctx);
GNUNET_free (get_result);
break;
case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16849 - gnunet/src/dht,
gnunet <=