diff options
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r-- | src/dht/gnunet-service-dht.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index 8efdcffbf..6bb3f12f9 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c | |||
@@ -2068,7 +2068,7 @@ datacache_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp, | |||
2068 | const char *data, enum GNUNET_BLOCK_Type type) | 2068 | const char *data, enum GNUNET_BLOCK_Type type) |
2069 | { | 2069 | { |
2070 | struct DHT_MessageContext *msg_ctx = cls; | 2070 | struct DHT_MessageContext *msg_ctx = cls; |
2071 | struct DHT_MessageContext *new_msg_ctx; | 2071 | struct DHT_MessageContext new_msg_ctx; |
2072 | struct GNUNET_DHT_GetResultMessage *get_result; | 2072 | struct GNUNET_DHT_GetResultMessage *get_result; |
2073 | enum GNUNET_BLOCK_EvaluationResult eval; | 2073 | enum GNUNET_BLOCK_EvaluationResult eval; |
2074 | const struct DHTPutEntry *put_entry; | 2074 | const struct DHTPutEntry *put_entry; |
@@ -2112,20 +2112,16 @@ datacache_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp, | |||
2112 | case GNUNET_BLOCK_EVALUATION_OK_LAST: | 2112 | case GNUNET_BLOCK_EVALUATION_OK_LAST: |
2113 | msg_ctx->do_forward = GNUNET_NO; | 2113 | msg_ctx->do_forward = GNUNET_NO; |
2114 | case GNUNET_BLOCK_EVALUATION_OK_MORE: | 2114 | case GNUNET_BLOCK_EVALUATION_OK_MORE: |
2115 | new_msg_ctx = GNUNET_malloc (sizeof (struct DHT_MessageContext)); | 2115 | memcpy (&new_msg_ctx, msg_ctx, sizeof (struct DHT_MessageContext)); |
2116 | memcpy (new_msg_ctx, msg_ctx, sizeof (struct DHT_MessageContext)); | ||
2117 | if (GNUNET_DHT_RO_RECORD_ROUTE == | 2116 | if (GNUNET_DHT_RO_RECORD_ROUTE == |
2118 | (msg_ctx->msg_options & GNUNET_DHT_RO_RECORD_ROUTE)) | 2117 | (msg_ctx->msg_options & GNUNET_DHT_RO_RECORD_ROUTE)) |
2119 | { | 2118 | { |
2120 | new_msg_ctx->msg_options = GNUNET_DHT_RO_RECORD_ROUTE; | 2119 | new_msg_ctx.msg_options = GNUNET_DHT_RO_RECORD_ROUTE; |
2121 | new_msg_ctx->path_history_len = msg_ctx->path_history_len; | ||
2122 | /* Assign to previous msg_ctx path history, caller should free after our return */ | ||
2123 | new_msg_ctx->path_history = msg_ctx->path_history; | ||
2124 | #if DEBUG_PATH | 2120 | #if DEBUG_PATH |
2125 | for (i = 0; i < new_msg_ctx->path_history_len; i++) | 2121 | for (i = 0; i < new_msg_ctx.path_history_len; i++) |
2126 | { | 2122 | { |
2127 | path_offset = | 2123 | path_offset = |
2128 | &new_msg_ctx->path_history[i * sizeof (struct GNUNET_PeerIdentity)]; | 2124 | &new_msg_ctx.path_history[i * sizeof (struct GNUNET_PeerIdentity)]; |
2129 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2125 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2130 | "(get_iterator) Key %s Found peer %d:%s\n", | 2126 | "(get_iterator) Key %s Found peer %d:%s\n", |
2131 | GNUNET_h2s (&msg_ctx->key), i, | 2127 | GNUNET_h2s (&msg_ctx->key), i, |
@@ -2161,15 +2157,13 @@ datacache_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp, | |||
2161 | memcpy (&get_result[1], &put_entry[1], | 2157 | memcpy (&get_result[1], &put_entry[1], |
2162 | put_entry->data_size + | 2158 | put_entry->data_size + |
2163 | (put_entry->path_length * sizeof (struct GNUNET_PeerIdentity))); | 2159 | (put_entry->path_length * sizeof (struct GNUNET_PeerIdentity))); |
2164 | new_msg_ctx->peer = &my_identity; | 2160 | new_msg_ctx.peer = &my_identity; |
2165 | new_msg_ctx->bloom = | 2161 | new_msg_ctx.bloom = NULL; |
2166 | GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, DHT_BLOOM_K); | 2162 | new_msg_ctx.hop_count = 0; |
2167 | new_msg_ctx->hop_count = 0; | 2163 | new_msg_ctx.importance = DHT_DEFAULT_P2P_IMPORTANCE + 2; /* Make result routing a higher priority */ |
2168 | new_msg_ctx->importance = DHT_DEFAULT_P2P_IMPORTANCE + 2; /* Make result routing a higher priority */ | 2164 | new_msg_ctx.timeout = DHT_DEFAULT_P2P_TIMEOUT; |
2169 | new_msg_ctx->timeout = DHT_DEFAULT_P2P_TIMEOUT; | ||
2170 | increment_stats (STAT_GET_RESPONSE_START); | 2165 | increment_stats (STAT_GET_RESPONSE_START); |
2171 | route_result_message (&get_result->header, new_msg_ctx); | 2166 | route_result_message (&get_result->header, &new_msg_ctx); |
2172 | GNUNET_free (new_msg_ctx); | ||
2173 | GNUNET_free (get_result); | 2167 | GNUNET_free (get_result); |
2174 | break; | 2168 | break; |
2175 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: | 2169 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: |