[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24857 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24857 - gnunet/src/mesh |
Date: |
Fri, 9 Nov 2012 12:49:10 +0100 |
Author: grothoff
Date: 2012-11-09 12:49:10 +0100 (Fri, 09 Nov 2012)
New Revision: 24857
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
gnunet/src/mesh/mesh_block_lib.c
gnunet/src/mesh/plugin_block_mesh.c
Log:
-new breaks
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2012-11-09 11:12:14 UTC (rev
24856)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2012-11-09 11:49:10 UTC (rev
24857)
@@ -1431,8 +1431,7 @@
struct MeshRegexSearchContext *new_ctx;
struct MeshRegexSearchInfo *info = ctx->info;
struct GNUNET_DHT_GetHandle *get_h;
- char *rest;
-
+ const char *rest;
int result;
/* Find the longest match for the current string position,
@@ -1460,6 +1459,7 @@
&ctx->hash,
®ex_result_iterator,
new_ctx);
+ // FIXME: "leaks" new_ctx? avoid keeping it around?
return; // We are already looking for it
}
@@ -7498,6 +7498,7 @@
const char *string;
size_t size;
size_t len;
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Connect by string started\n");
msg = (struct GNUNET_MESH_ConnectPeerByString *) message;
@@ -7565,9 +7566,7 @@
info = GNUNET_malloc (sizeof (struct MeshRegexSearchInfo));
info->t = t;
- info->description = GNUNET_malloc (len + 1);
- memcpy (info->description, string, len);
- info->description[len] = '\0';
+ info->description = GNUNET_strndup (string, len);
info->dht_get_handles = GNUNET_CONTAINER_multihashmap_create(32, GNUNET_NO);
info->dht_get_results = GNUNET_CONTAINER_multihashmap_create(32, GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " string: %s\n", info->description);
Modified: gnunet/src/mesh/mesh_block_lib.c
===================================================================
--- gnunet/src/mesh/mesh_block_lib.c 2012-11-09 11:12:14 UTC (rev 24856)
+++ gnunet/src/mesh/mesh_block_lib.c 2012-11-09 11:49:10 UTC (rev 24857)
@@ -41,6 +41,7 @@
int found;
};
+
/**
* Iterator over all edges in a block, checking for a presence of a given
query.
*
@@ -58,11 +59,9 @@
const struct GNUNET_HashCode *key)
{
struct mesh_block_xquery_ctx *ctx = cls;
- char *s;
- s = strndup (token, len);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " edge %s [%u]\n", s, len);
- GNUNET_free (s);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " edge %.*s [%u]\n",
+ (int) len, token, len);
if (strlen (ctx->xquery) < len)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " too long!\n");
@@ -78,7 +77,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " KO!\n");
}
- return GNUNET_YES; // keep checking for malformed data!
+ return GNUNET_YES; /* keep checking for malformed data! */
}
@@ -101,14 +100,13 @@
int res;
struct mesh_block_xquery_ctx ctx;
+ if ( (GNUNET_YES == ntohl(block->accepting)) && (xquery[0] == '\0') )
+ return GNUNET_OK;
ctx.xquery = xquery;
ctx.found = GNUNET_NO;
res = GNUNET_MESH_regex_block_iterate (block, size, &check_edge, &ctx);
if (GNUNET_SYSERR == res)
return GNUNET_SYSERR;
-
- if (GNUNET_YES == ntohl(block->accepting) && xquery[0] == '\0')
- return GNUNET_OK;
return ctx.found;
}
@@ -144,6 +142,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"* Block is smaller than struct MeshRegexBlock, END\n");
+ GNUNET_break_op (0);
return GNUNET_SYSERR;
}
n = ntohl (block->n_proof);
@@ -154,6 +153,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"* Block is smaller than Block + proof, END\n");
+ GNUNET_break_op (0);
return GNUNET_SYSERR;
}
aux = (char *) &block[1]; // Skip regex block
@@ -168,6 +168,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"* Size not enough for MeshRegexEdge, END\n");
+ GNUNET_break_op (0);
return GNUNET_SYSERR;
}
edge = (struct MeshRegexEdge *) aux;
@@ -179,6 +180,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"* Size not enough for edge token, END\n");
+ GNUNET_break_op (0);
return GNUNET_SYSERR;
}
aux = (char *) &edge[1]; // Skip edge block
@@ -196,6 +198,7 @@
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"* Size %u, read %u END KO\n", size, offset);
+ GNUNET_break_op (0);
return GNUNET_SYSERR;
}
Modified: gnunet/src/mesh/plugin_block_mesh.c
===================================================================
--- gnunet/src/mesh/plugin_block_mesh.c 2012-11-09 11:12:14 UTC (rev 24856)
+++ gnunet/src/mesh/plugin_block_mesh.c 2012-11-09 11:49:10 UTC (rev 24857)
@@ -117,11 +117,10 @@
return GNUNET_BLOCK_EVALUATION_REQUEST_VALID;
if (0 != xquery_size)
{
- char *query;
+ const char *query;
- query = (char *) xquery;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "BLOCK XQUERY %s\n", query);
- if ('\0' != query[xquery_size - 1]) // must be valid string
+ query = (const char *) xquery;
+ if ('\0' != query[xquery_size - 1]) /* must be valid string */
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Block xquery not a valid string\n");
@@ -130,6 +129,7 @@
}
else
{
+ GNUNET_break_op (0);
return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
}
switch (GNUNET_MESH_regex_block_check (reply_block,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24857 - gnunet/src/mesh,
gnunet <=