gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r22528 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r22528 - gnunet/src/mesh
Date: Fri, 6 Jul 2012 16:40:23 +0200

Author: bartpolot
Date: 2012-07-06 16:40:23 +0200 (Fri, 06 Jul 2012)
New Revision: 22528

Modified:
   gnunet/src/mesh/gnunet-service-mesh_new.c
Log:
- use all functions, declare edge iterator

Modified: gnunet/src/mesh/gnunet-service-mesh_new.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_new.c   2012-07-06 14:30:09 UTC (rev 
22527)
+++ gnunet/src/mesh/gnunet-service-mesh_new.c   2012-07-06 14:40:23 UTC (rev 
22528)
@@ -4120,7 +4120,46 @@
                         unsigned int put_path_length, enum GNUNET_BLOCK_Type 
type,
                         size_t size, const void *data);
 
+/**
+ * Iterator over edges in a block.
+ *
+ * @param cls Closure.
+ * @param token Token that follows to next state.
+ * @param len Lenght of token.
+ * @param key Hash of next state.
+ *
+ * @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);
+/**
+ * Iterator over hash map entries.
+ *
+ * @param cls closure
+ * @param key current key code
+ * @param value value in the hash map
+ * @return GNUNET_YES if we should continue to
+ *         iterate,
+ *         GNUNET_NO if not.
+ */
+static int
+regex_result_iterator (void *cls,
+                       const struct GNUNET_HashCode * key,
+                       void *value)
+{
+  struct MeshRegexBlock *block = value;
+  struct MeshRegexSearchContext *ctx = cls;
 
+  // block was checked when stored, no need to check again
+  (void) GNUNET_MESH_regex_block_iterate (block, SIZE_MAX,
+                                          &regex_edge_iterator, ctx);
+
+  return GNUNET_YES;
+}
+
 /**
  * Iterator over edges in a block.
  *
@@ -4167,7 +4206,7 @@
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "*     GET running, END\n");
     GNUNET_CONTAINER_multihashmap_get_multiple (ctx->dht_get_results, key,
-                                                NULL, ctx);
+                                                &regex_result_iterator, ctx);
     return GNUNET_YES; // We are already looking for it
   }
   /* Start search in DHT */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]