[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26384 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26384 - gnunet/src/dht |
Date: |
Mon, 11 Mar 2013 16:37:46 +0100 |
Author: bartpolot
Date: 2013-03-11 16:37:46 +0100 (Mon, 11 Mar 2013)
New Revision: 26384
Modified:
gnunet/src/dht/gnunet-service-dht_neighbours.c
Log:
BLOCK_EVALUATE regex PUT messages
- reorder debug info for easier following
Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c 2013-03-11 15:27:58 UTC
(rev 26383)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c 2013-03-11 15:37:46 UTC
(rev 26384)
@@ -49,7 +49,9 @@
#include <fenv.h>
#include "dht.h"
+#include "../regex/regex_block_lib.h"
+
#define LOG_TRAFFIC(kind,...) GNUNET_log_from (kind, "dht-traffic",__VA_ARGS__)
/**
@@ -1586,6 +1588,21 @@
payload_size =
msize - (sizeof (struct PeerPutMessage) +
putlen * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "PUT for `%s' from %s\n",
+ GNUNET_h2s (&put->key), GNUNET_i2s (peer));
+ if (GNUNET_YES == log_route_details_stderr)
+ {
+ char *tmp;
+
+ tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
+ LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XDHT PUT %s: %s->%s (%u,
%u=>%u)\n",
+ GNUNET_h2s (&put->key), GNUNET_i2s (peer), tmp,
+ ntohl(put->hop_count),
+ GNUNET_CRYPTO_hash_matching_bits (&peer->hashPubKey,
&put->key),
+ GNUNET_CRYPTO_hash_matching_bits (&my_identity.hashPubKey,
&put->key)
+ );
+ GNUNET_free (tmp);
+ }
switch (GNUNET_BLOCK_get_key
(GDS_block_context, ntohl (put->type), payload, payload_size,
&test_key))
@@ -1604,24 +1621,31 @@
/* cannot verify, good luck */
break;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "PUT for `%s' from %s\n",
- GNUNET_h2s (&put->key), GNUNET_i2s (peer));
-
- if (GNUNET_YES == log_route_details_stderr)
+ if (ntohl (put->type) == GNUNET_BLOCK_TYPE_REGEX) /* FIXME: do for all tpyes
*/
{
- char *tmp;
+ switch (GNUNET_BLOCK_evaluate (GDS_block_context,
+ ntohl (put->type),
+ NULL, /* query */
+ NULL, 0, /* bloom filer */
+ NULL, 0, /* xquery */
+ payload, payload_size))
+ {
+ case GNUNET_BLOCK_EVALUATION_OK_MORE:
+ case GNUNET_BLOCK_EVALUATION_OK_LAST:
+ break;
- tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
- LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XDHT PUT %s: %s->%s (%u,
%u=>%u)\n",
- GNUNET_h2s (&put->key), GNUNET_i2s (peer), tmp,
- ntohl(put->hop_count),
- GNUNET_CRYPTO_hash_matching_bits (&peer->hashPubKey,
&put->key),
- GNUNET_CRYPTO_hash_matching_bits (&my_identity.hashPubKey,
&put->key)
- );
- GNUNET_free (tmp);
+ case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
+ case GNUNET_BLOCK_EVALUATION_RESULT_INVALID:
+ case GNUNET_BLOCK_EVALUATION_RESULT_IRRELEVANT:
+ case GNUNET_BLOCK_EVALUATION_REQUEST_VALID:
+ case GNUNET_BLOCK_EVALUATION_REQUEST_INVALID:
+ case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED:
+ default:
+ GNUNET_break_op (0);
+ return GNUNET_OK;
+ }
}
-
bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter, DHT_BLOOM_SIZE,
GNUNET_CONSTANTS_BLOOMFILTER_K);
GNUNET_break_op (GNUNET_YES ==
@@ -1809,14 +1833,30 @@
GNUNET_break_op (0);
return GNUNET_YES;
}
- GNUNET_STATISTICS_update (GDS_stats,
- gettext_noop ("# P2P GET requests received"), 1,
- GNUNET_NO);
reply_bf_size = msize - (sizeof (struct PeerGetMessage) + xquery_size);
type = ntohl (get->type);
options = ntohl (get->options);
xquery = (const char *) &get[1];
reply_bf = NULL;
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# P2P GET requests received"), 1,
+ GNUNET_NO);
+ if (GNUNET_YES == log_route_details_stderr)
+ {
+ char *tmp;
+
+ tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
+ LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
+ "XDHT GET %s: %s->%s (%u, %u=>%u) xq: %.*s\n",
+ GNUNET_h2s (&get->key), GNUNET_i2s (peer), tmp,
+ ntohl(get->hop_count),
+ GNUNET_CRYPTO_hash_matching_bits (&peer->hashPubKey,
&get->key),
+ GNUNET_CRYPTO_hash_matching_bits (&my_identity.hashPubKey,
&get->key),
+ ntohl(get->xquery_size), xquery
+ );
+ GNUNET_free (tmp);
+ }
+
if (reply_bf_size > 0)
reply_bf =
GNUNET_CONTAINER_bloomfilter_init (&xquery[xquery_size], reply_bf_size,
@@ -1870,22 +1910,6 @@
1, GNUNET_NO);
}
- if (GNUNET_YES == log_route_details_stderr)
- {
- char *tmp;
-
- tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
- LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
- "XDHT GET %s: %s->%s (%u, %u=>%u) xq: %.*s\n",
- GNUNET_h2s (&get->key), GNUNET_i2s (peer), tmp,
- ntohl(get->hop_count),
- GNUNET_CRYPTO_hash_matching_bits (&peer->hashPubKey,
&get->key),
- GNUNET_CRYPTO_hash_matching_bits (&my_identity.hashPubKey,
&get->key),
- ntohl(get->xquery_size), xquery
- );
- GNUNET_free (tmp);
- }
-
GDS_CLIENTS_process_get (options,
type,
ntohl(get->hop_count),
@@ -1955,8 +1979,6 @@
GNUNET_break_op (0);
return GNUNET_YES;
}
- GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P RESULTS received"),
- 1, GNUNET_NO);
put_path = (const struct GNUNET_PeerIdentity *) &prm[1];
get_path = &put_path[put_path_length];
type = ntohl (prm->type);
@@ -1965,7 +1987,18 @@
msize - (sizeof (struct PeerResultMessage) +
(get_path_length +
put_path_length) * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P RESULTS received"),
+ 1, GNUNET_NO);
+ if (GNUNET_YES == log_route_details_stderr)
+ {
+ char *tmp;
+ tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
+ LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XDHT RESULT %s: %s->%s (%u)\n",
+ GNUNET_h2s (&prm->key), GNUNET_i2s (peer), tmp,
+ get_path_length + 1);
+ GNUNET_free (tmp);
+ }
/* if we got a HELLO, consider it for our own routing table */
if (type == GNUNET_BLOCK_TYPE_DHT_HELLO)
{
@@ -2005,18 +2038,6 @@
}
}
-
- if (GNUNET_YES == log_route_details_stderr)
- {
- char *tmp;
-
- tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
- LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XDHT RESULT %s: %s->%s (%u)\n",
- GNUNET_h2s (&prm->key), GNUNET_i2s (peer), tmp,
- get_path_length + 1);
- GNUNET_free (tmp);
- }
-
/* append 'peer' to 'get_path' */
{
struct GNUNET_PeerIdentity xget_path[get_path_length + 1];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26384 - gnunet/src/dht,
gnunet <=