diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-01-26 16:47:56 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-01-26 16:47:56 +0000 |
commit | d412dbaf5d4014aa1a491ebf0a2a5aaa50e588fe (patch) | |
tree | a9fcf216115c35cee54ee8ffcc7291aced63d6f3 /src/set | |
parent | 11784c93530f249e4106954cf025e99d10a1f9d1 (diff) | |
download | gnunet-d412dbaf5d4014aa1a491ebf0a2a5aaa50e588fe.tar.gz gnunet-d412dbaf5d4014aa1a491ebf0a2a5aaa50e588fe.zip |
- activated testcase for set intersection, as it not works correctly
- some bugfixes for intersection
- corrected a logics bug in intersection
Diffstat (limited to 'src/set')
-rw-r--r-- | src/set/Makefile.am | 11 | ||||
-rw-r--r-- | src/set/gnunet-service-set.c | 3 | ||||
-rw-r--r-- | src/set/gnunet-service-set_intersection.c | 13 |
3 files changed, 17 insertions, 10 deletions
diff --git a/src/set/Makefile.am b/src/set/Makefile.am index a2bbab9a6..a02d80b9e 100644 --- a/src/set/Makefile.am +++ b/src/set/Makefile.am | |||
@@ -66,7 +66,7 @@ libgnunetset_la_LDFLAGS = \ | |||
66 | 66 | ||
67 | if HAVE_TESTING | 67 | if HAVE_TESTING |
68 | check_PROGRAMS = \ | 68 | check_PROGRAMS = \ |
69 | test_set_api test_set_union_result_full | 69 | test_set_api test_set_union_result_full test_set_intersection_result_full |
70 | endif | 70 | endif |
71 | 71 | ||
72 | if ENABLE_TEST_RUN | 72 | if ENABLE_TEST_RUN |
@@ -92,6 +92,15 @@ test_set_union_result_full_LDADD = \ | |||
92 | test_set_union_result_full_DEPENDENCIES = \ | 92 | test_set_union_result_full_DEPENDENCIES = \ |
93 | libgnunetset.la | 93 | libgnunetset.la |
94 | 94 | ||
95 | test_set_intersection_result_full_SOURCES = \ | ||
96 | test_set_intersection_result_full.c | ||
97 | test_set_intersection_result_full_LDADD = \ | ||
98 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
99 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
100 | $(top_builddir)/src/set/libgnunetset.la | ||
101 | test_set_intersection_result_full_DEPENDENCIES = \ | ||
102 | libgnunetset.la | ||
103 | |||
95 | EXTRA_DIST = \ | 104 | EXTRA_DIST = \ |
96 | test_set.conf | 105 | test_set.conf |
97 | 106 | ||
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c index 3c089f395..73d8f95cd 100644 --- a/src/set/gnunet-service-set.c +++ b/src/set/gnunet-service-set.c | |||
@@ -728,8 +728,7 @@ handle_client_create_set (void *cls, | |||
728 | switch (ntohs (msg->operation)) | 728 | switch (ntohs (msg->operation)) |
729 | { | 729 | { |
730 | case GNUNET_SET_OPERATION_INTERSECTION: | 730 | case GNUNET_SET_OPERATION_INTERSECTION: |
731 | // FIXME: implement intersection vt | 731 | set->vt = _GSS_intersection_vt (); |
732 | // set->vt = _GSS_intersection_vt (); | ||
733 | break; | 732 | break; |
734 | case GNUNET_SET_OPERATION_UNION: | 733 | case GNUNET_SET_OPERATION_UNION: |
735 | set->vt = _GSS_union_vt (); | 734 | set->vt = _GSS_union_vt (); |
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c index a28938e04..cc0c721af 100644 --- a/src/set/gnunet-service-set_intersection.c +++ b/src/set/gnunet-service-set_intersection.c | |||
@@ -210,8 +210,8 @@ iterator_initialization_by_alice (void *cls, | |||
210 | struct GNUNET_HashCode mutated_hash; | 210 | struct GNUNET_HashCode mutated_hash; |
211 | 211 | ||
212 | //only consider this element, if it is valid for us | 212 | //only consider this element, if it is valid for us |
213 | if ((op->generation_created >= ee->generation_removed) | 213 | if ((op->generation_created < ee->generation_removed) |
214 | || (op->generation_created < ee->generation_added)) | 214 | && (op->generation_created >= ee->generation_added)) |
215 | return GNUNET_YES; | 215 | return GNUNET_YES; |
216 | 216 | ||
217 | // not contained according to bob's bloomfilter | 217 | // not contained according to bob's bloomfilter |
@@ -254,8 +254,8 @@ iterator_initialization (void *cls, | |||
254 | struct Operation *op = cls; | 254 | struct Operation *op = cls; |
255 | 255 | ||
256 | //only consider this element, if it is valid for us | 256 | //only consider this element, if it is valid for us |
257 | if ((op->generation_created >= ee->generation_removed) | 257 | if ((op->generation_created < ee->generation_removed) |
258 | || (op->generation_created < ee->generation_added)) | 258 | && (op->generation_created >= ee->generation_added)) |
259 | return GNUNET_YES; | 259 | return GNUNET_YES; |
260 | 260 | ||
261 | GNUNET_assert (GNUNET_YES == | 261 | GNUNET_assert (GNUNET_YES == |
@@ -456,7 +456,7 @@ send_bloomfilter (struct Operation *op) | |||
456 | bf_elementbits); | 456 | bf_elementbits); |
457 | 457 | ||
458 | op->spec->salt++; | 458 | op->spec->salt++; |
459 | GNUNET_CONTAINER_multihashmap_iterate (op->spec->set->elements, | 459 | GNUNET_CONTAINER_multihashmap_iterate (op->state->my_elements, |
460 | &iterator_bf_create, | 460 | &iterator_bf_create, |
461 | op); | 461 | op); |
462 | 462 | ||
@@ -602,7 +602,7 @@ process_bf (struct Operation *op){ | |||
602 | case PHASE_BF_EXCHANGE: | 602 | case PHASE_BF_EXCHANGE: |
603 | case PHASE_MAYBE_FINISHED: | 603 | case PHASE_MAYBE_FINISHED: |
604 | // if we are bob or alice and are continuing operation | 604 | // if we are bob or alice and are continuing operation |
605 | GNUNET_CONTAINER_multihashmap_iterate (op->spec->set->elements, | 605 | GNUNET_CONTAINER_multihashmap_iterate (op->state->my_elements, |
606 | &iterator_bf_reduce, | 606 | &iterator_bf_reduce, |
607 | op); | 607 | op); |
608 | break; | 608 | break; |
@@ -919,7 +919,6 @@ static void | |||
919 | intersection_add (struct SetState *set_state, | 919 | intersection_add (struct SetState *set_state, |
920 | struct ElementEntry *ee) | 920 | struct ElementEntry *ee) |
921 | { | 921 | { |
922 | GNUNET_assert(0 < set_state->current_set_element_count); | ||
923 | set_state->current_set_element_count++; | 922 | set_state->current_set_element_count++; |
924 | } | 923 | } |
925 | 924 | ||