[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23865 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23865 - gnunet/src/mesh |
Date: |
Mon, 17 Sep 2012 17:59:03 +0200 |
Author: bartpolot
Date: 2012-09-17 17:59:02 +0200 (Mon, 17 Sep 2012)
New Revision: 23865
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
Log:
- fix strided regex usage
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2012-09-17 15:21:07 UTC (rev
23864)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2012-09-17 15:59:02 UTC (rev
23865)
@@ -1140,20 +1140,18 @@
/**
- * Iterator over edges in a regex block retrieved from the DHT.
+ * Jump to the next edge, with the longest matching token.
*
- * @param cls Closure.
- * @param token Token that follows to next state.
- * @param len Lenght of token.
- * @param key Hash of next state.
+ * @param block Block found in the DHT.
+ * @param size Size of the block.
+ * @param ctx Context of the search.
*
* @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise.
*/
-static int
-regex_edge_iterator (void *cls,
- const char *token,
- size_t len,
- const struct GNUNET_HashCode *key);
+static void
+regex_next_edge (const struct MeshRegexBlock *block,
+ size_t size,
+ struct MeshRegexSearchContext *ctx);
/**
@@ -1255,8 +1253,7 @@
ntohl(block->accepting));
}
- (void) GNUNET_MESH_regex_block_iterate (block, SIZE_MAX,
- ®ex_edge_iterator, ctx);
+ regex_next_edge(block, SIZE_MAX, ctx);
return GNUNET_YES;
}
@@ -1310,6 +1307,10 @@
ctx->longest_match = len;
ctx->hash = *key;
}
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* Token is not longer,
IGNORE\n");
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* End of regex edge iterator\n");
return GNUNET_YES;
@@ -1334,6 +1335,8 @@
struct MeshRegexSearchInfo *info = ctx->info;
struct GNUNET_DHT_GetHandle *get_h;
+ /* Find the longest match for the current string position,
+ * among tokens in the given block */
GNUNET_break (GNUNET_OK ==
GNUNET_MESH_regex_block_iterate (block, size,
®ex_edge_iterator, ctx));
@@ -1342,6 +1345,8 @@
new_ctx->info = info;
new_ctx->position = ctx->position + ctx->longest_match;
GNUNET_array_append (info->contexts, info->n_contexts, new_ctx);
+
+ /* Check whether we already have a DHT GET running for it */
if (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_contains(info->dht_get_handles,
&ctx->hash))
{
@@ -1352,6 +1357,7 @@
new_ctx);
return; // We are already looking for it
}
+
/* Start search in DHT */
get_h =
GNUNET_DHT_get_start (dht_handle, /* handle */
@@ -6098,7 +6104,8 @@
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
- unsigned int put_path_length, enum GNUNET_BLOCK_Type
type,
+ unsigned int put_path_length,
+ enum GNUNET_BLOCK_Type type,
size_t size, const void *data)
{
const struct MeshRegexBlock *block = data;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23865 - gnunet/src/mesh,
gnunet <=