diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-07-05 13:55:50 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-07-05 13:55:50 +0000 |
commit | af983018bce8c0b369fd392e5cbc3996627a1527 (patch) | |
tree | 08a5d030a613cfe3c28a76956540394aa0735603 | |
parent | 06fcd88b725111a2d404888210f8dbe3b848a44b (diff) | |
download | gnunet-af983018bce8c0b369fd392e5cbc3996627a1527.tar.gz gnunet-af983018bce8c0b369fd392e5cbc3996627a1527.zip |
- improved debug messages, added break_op for malformed block
-rw-r--r-- | src/mesh/gnunet-service-mesh_new.c | 7 | ||||
-rw-r--r-- | src/mesh/plugin_block_mesh.c | 21 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/mesh/gnunet-service-mesh_new.c b/src/mesh/gnunet-service-mesh_new.c index 52485dcdd..23d462e22 100644 --- a/src/mesh/gnunet-service-mesh_new.c +++ b/src/mesh/gnunet-service-mesh_new.c | |||
@@ -740,8 +740,11 @@ regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, | |||
740 | " regex dht put for state %s\n", | 740 | " regex dht put for state %s\n", |
741 | GNUNET_h2s(key)); | 741 | GNUNET_h2s(key)); |
742 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 742 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
743 | " proof: %s\n", | 743 | " proof: %s\n", |
744 | proof); | 744 | proof); |
745 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
746 | " num edges: %u\n", | ||
747 | num_edges); | ||
745 | 748 | ||
746 | opt = GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE; | 749 | opt = GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE; |
747 | if (GNUNET_YES == accepting) | 750 | if (GNUNET_YES == accepting) |
@@ -749,7 +752,7 @@ regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, | |||
749 | struct MeshRegexAccept block; | 752 | struct MeshRegexAccept block; |
750 | 753 | ||
751 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 754 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
752 | " state %s is accepting, putting own id\n", | 755 | " state %s is accepting, putting own id\n", |
753 | GNUNET_h2s(key)); | 756 | GNUNET_h2s(key)); |
754 | size = sizeof (block); | 757 | size = sizeof (block); |
755 | block.key = *key; | 758 | block.key = *key; |
diff --git a/src/mesh/plugin_block_mesh.c b/src/mesh/plugin_block_mesh.c index 1a530cdc0..8c080c485 100644 --- a/src/mesh/plugin_block_mesh.c +++ b/src/mesh/plugin_block_mesh.c | |||
@@ -87,20 +87,23 @@ block_plugin_mesh_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
87 | } | 87 | } |
88 | if (NULL == reply_block) | 88 | if (NULL == reply_block) |
89 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; | 89 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; |
90 | if (sizeof (struct PBlock) != reply_block_size) | 90 | if (sizeof (struct PBlock) != reply_block_size) |
91 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 91 | { |
92 | GNUNET_break_op(0); | ||
93 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | ||
94 | } | ||
92 | if (NULL != bf) | 95 | if (NULL != bf) |
93 | { | 96 | { |
94 | GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash); | 97 | GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash); |
95 | GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash); | 98 | GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash); |
96 | if (NULL != *bf) | 99 | if (NULL != *bf) |
97 | { | 100 | { |
98 | if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash)) | 101 | if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash)) |
99 | return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; | 102 | return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; |
100 | } | 103 | } |
101 | else | 104 | else |
102 | { | 105 | { |
103 | *bf = GNUNET_CONTAINER_bloomfilter_init (NULL, 8, BLOOMFILTER_K); | 106 | *bf = GNUNET_CONTAINER_bloomfilter_init (NULL, 8, BLOOMFILTER_K); |
104 | } | 107 | } |
105 | GNUNET_CONTAINER_bloomfilter_add (*bf, &mhash); | 108 | GNUNET_CONTAINER_bloomfilter_add (*bf, &mhash); |
106 | } | 109 | } |
@@ -115,7 +118,10 @@ block_plugin_mesh_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
115 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; | 118 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; |
116 | if (GNUNET_OK != GNUNET_MESH_regex_block_check (reply_block, | 119 | if (GNUNET_OK != GNUNET_MESH_regex_block_check (reply_block, |
117 | reply_block_size)) | 120 | reply_block_size)) |
121 | { | ||
122 | GNUNET_break_op(0); | ||
118 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 123 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
124 | } | ||
119 | if (NULL != bf) | 125 | if (NULL != bf) |
120 | { | 126 | { |
121 | GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash); | 127 | GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash); |
@@ -140,8 +146,11 @@ block_plugin_mesh_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
140 | } | 146 | } |
141 | if (NULL == reply_block) | 147 | if (NULL == reply_block) |
142 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; | 148 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; |
143 | if (sizeof (struct MeshRegexAccept) != reply_block_size) | 149 | if (sizeof (struct MeshRegexAccept) != reply_block_size) |
150 | { | ||
151 | GNUNET_break_op(0); | ||
144 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 152 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
153 | } | ||
145 | if (NULL != bf) | 154 | if (NULL != bf) |
146 | { | 155 | { |
147 | GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash); | 156 | GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash); |