[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21925 - gnunet/src/block
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21925 - gnunet/src/block |
Date: |
Tue, 12 Jun 2012 21:02:54 +0200 |
Author: grothoff
Date: 2012-06-12 21:02:54 +0200 (Tue, 12 Jun 2012)
New Revision: 21925
Modified:
gnunet/src/block/plugin_block_template.c
Log:
-adding block duplicating detection to template for block plugins
Modified: gnunet/src/block/plugin_block_template.c
===================================================================
--- gnunet/src/block/plugin_block_template.c 2012-06-12 18:52:34 UTC (rev
21924)
+++ gnunet/src/block/plugin_block_template.c 2012-06-12 19:02:54 UTC (rev
21925)
@@ -53,6 +53,27 @@
size_t xquery_size, const void *reply_block,
size_t reply_block_size)
{
+ struct GNUNET_HashCode chash;
+ struct GNUNET_HashCode mhash;
+ /* FIXME: check validity first... */
+
+ /* mandatory duplicate-detection code... */
+ if (NULL != bf)
+ {
+ GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash);
+ GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash);
+ if (NULL != *bf)
+ {
+ if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash))
+ return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE;
+ }
+ else
+ {
+ *bf = GNUNET_CONTAINER_bloomfilter_init (NULL, 8, 64 /* BLOOMFILTER_K
*/);
+ }
+ GNUNET_CONTAINER_bloomfilter_add (*bf, &mhash);
+ }
+ /* FIXME: other stuff here... */
return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21925 - gnunet/src/block,
gnunet <=