diff options
Diffstat (limited to 'src/set/gnunet-service-set_union.c')
-rw-r--r-- | src/set/gnunet-service-set_union.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c index c69aa2a9c..b5b602074 100644 --- a/src/set/gnunet-service-set_union.c +++ b/src/set/gnunet-service-set_union.c | |||
@@ -761,7 +761,8 @@ get_order_from_difference (unsigned int diff) | |||
761 | ibf_order++; | 761 | ibf_order++; |
762 | if (ibf_order > MAX_IBF_ORDER) | 762 | if (ibf_order > MAX_IBF_ORDER) |
763 | ibf_order = MAX_IBF_ORDER; | 763 | ibf_order = MAX_IBF_ORDER; |
764 | return ibf_order; | 764 | // add one for correction |
765 | return ibf_order + 1; | ||
765 | } | 766 | } |
766 | 767 | ||
767 | 768 | ||
@@ -872,6 +873,12 @@ handle_p2p_strata_estimator (void *cls, | |||
872 | GNUNET_assert (NULL != op->state->se); | 873 | GNUNET_assert (NULL != op->state->se); |
873 | diff = strata_estimator_difference (remote_se, | 874 | diff = strata_estimator_difference (remote_se, |
874 | op->state->se); | 875 | op->state->se); |
876 | |||
877 | if (diff > 200) | ||
878 | diff = diff * 3 / 2; | ||
879 | |||
880 | |||
881 | |||
875 | strata_estimator_destroy (remote_se); | 882 | strata_estimator_destroy (remote_se); |
876 | strata_estimator_destroy (op->state->se); | 883 | strata_estimator_destroy (op->state->se); |
877 | op->state->se = NULL; | 884 | op->state->se = NULL; |
@@ -880,6 +887,17 @@ handle_p2p_strata_estimator (void *cls, | |||
880 | diff, | 887 | diff, |
881 | 1<<get_order_from_difference (diff)); | 888 | 1<<get_order_from_difference (diff)); |
882 | 889 | ||
890 | { | ||
891 | char *set_debug; | ||
892 | set_debug = getenv ("GNUNET_SET_BENCHMARK"); | ||
893 | if ( (NULL != set_debug) && (0 == strcmp (set_debug, "1")) ) | ||
894 | { | ||
895 | FILE *f = fopen ("set.log", "a"); | ||
896 | fprintf (f, "%llu\n", (unsigned long long) diff); | ||
897 | fclose (f); | ||
898 | } | ||
899 | } | ||
900 | |||
883 | if ((GNUNET_YES == op->spec->byzantine) && (other_size < op->spec->byzantine_lower_bound)) | 901 | if ((GNUNET_YES == op->spec->byzantine) && (other_size < op->spec->byzantine_lower_bound)) |
884 | { | 902 | { |
885 | GNUNET_break (0); | 903 | GNUNET_break (0); |
@@ -888,12 +906,16 @@ handle_p2p_strata_estimator (void *cls, | |||
888 | } | 906 | } |
889 | 907 | ||
890 | 908 | ||
891 | if ( (GNUNET_YES == op->spec->force_full) || (diff > op->state->initial_size / 2)) | 909 | if ( (GNUNET_YES == op->spec->force_full) || (diff > op->state->initial_size / 4)) |
892 | { | 910 | { |
893 | LOG (GNUNET_ERROR_TYPE_INFO, | 911 | LOG (GNUNET_ERROR_TYPE_INFO, |
894 | "Sending full set (diff=%d, own set=%u)\n", | 912 | "Sending full set (diff=%d, own set=%u)\n", |
895 | diff, | 913 | diff, |
896 | op->state->initial_size); | 914 | op->state->initial_size); |
915 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
916 | "# of full sends", | ||
917 | 1, | ||
918 | GNUNET_NO); | ||
897 | if (op->state->initial_size <= other_size) | 919 | if (op->state->initial_size <= other_size) |
898 | { | 920 | { |
899 | send_full_set (op); | 921 | send_full_set (op); |
@@ -908,6 +930,10 @@ handle_p2p_strata_estimator (void *cls, | |||
908 | } | 930 | } |
909 | else | 931 | else |
910 | { | 932 | { |
933 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
934 | "# of ibf sends", | ||
935 | 1, | ||
936 | GNUNET_NO); | ||
911 | if (GNUNET_OK != | 937 | if (GNUNET_OK != |
912 | send_ibf (op, | 938 | send_ibf (op, |
913 | get_order_from_difference (diff))) | 939 | get_order_from_difference (diff))) |
@@ -1556,10 +1582,14 @@ handle_p2p_full_element (void *cls, | |||
1556 | } | 1582 | } |
1557 | 1583 | ||
1558 | if ( (GNUNET_YES == op->spec->byzantine) && | 1584 | if ( (GNUNET_YES == op->spec->byzantine) && |
1559 | (op->state->received_total > 8) && | 1585 | (op->state->received_total > 384 + op->state->received_fresh * 4) && |
1560 | (op->state->received_fresh < op->state->received_total / 3) ) | 1586 | (op->state->received_fresh < op->state->received_total / 6) ) |
1561 | { | 1587 | { |
1562 | /* The other peer gave us lots of old elements, there's something wrong. */ | 1588 | /* The other peer gave us lots of old elements, there's something wrong. */ |
1589 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1590 | "Other peer sent only %llu/%llu fresh elements, failing operation\n", | ||
1591 | (unsigned long long) op->state->received_fresh, | ||
1592 | (unsigned long long) op->state->received_total); | ||
1563 | GNUNET_break_op (0); | 1593 | GNUNET_break_op (0); |
1564 | fail_union_operation (op); | 1594 | fail_union_operation (op); |
1565 | return; | 1595 | return; |