diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-12-29 20:47:17 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-12-29 20:47:17 +0100 |
commit | 9e0d7d411363999bca89f7e7b4e2896b8f6ec931 (patch) | |
tree | 667e3d8d2eeff8d3384f373dcb7a7b6d5da8a64a | |
parent | 9859314207ad10e37b73eacd5dfccac59ec8153e (diff) | |
download | gnunet-9e0d7d411363999bca89f7e7b4e2896b8f6ec931.tar.gz gnunet-9e0d7d411363999bca89f7e7b4e2896b8f6ec931.zip |
-migrate code to new block API
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 39 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.c | 12 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.h | 2 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_cp.c | 26 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 99 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.h | 28 | ||||
-rw-r--r-- | src/fs/test_plugin_block_fs.c | 45 |
7 files changed, 122 insertions, 129 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 75bdaed53..d48d2a5df 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -1859,18 +1859,17 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender, | |||
1859 | /* first, check about our own HELLO */ | 1859 | /* first, check about our own HELLO */ |
1860 | if (NULL != GDS_my_hello) | 1860 | if (NULL != GDS_my_hello) |
1861 | { | 1861 | { |
1862 | hello_size = GNUNET_HELLO_size ((const struct | 1862 | hello_size = GNUNET_HELLO_size ( |
1863 | GNUNET_HELLO_Message *) GDS_my_hello); | 1863 | (const struct GNUNET_HELLO_Message *) GDS_my_hello); |
1864 | GNUNET_break (hello_size >= sizeof(struct GNUNET_MessageHeader)); | 1864 | GNUNET_break (hello_size >= sizeof(struct GNUNET_MessageHeader)); |
1865 | if (GNUNET_BLOCK_EVALUATION_OK_MORE == | 1865 | if (GNUNET_BLOCK_REPLY_OK_MORE == |
1866 | GNUNET_BLOCK_evaluate (GDS_block_context, | 1866 | GNUNET_BLOCK_check_reply (GDS_block_context, |
1867 | GNUNET_BLOCK_TYPE_DHT_HELLO, | 1867 | GNUNET_BLOCK_TYPE_DHT_HELLO, |
1868 | bg, | 1868 | bg, |
1869 | GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO, | 1869 | &my_identity_hash, |
1870 | &my_identity_hash, | 1870 | NULL, 0, |
1871 | NULL, 0, | 1871 | GDS_my_hello, |
1872 | GDS_my_hello, | 1872 | hello_size)) |
1873 | hello_size)) | ||
1874 | { | 1873 | { |
1875 | GDS_NEIGHBOURS_handle_reply (sender, | 1874 | GDS_NEIGHBOURS_handle_reply (sender, |
1876 | GNUNET_BLOCK_TYPE_DHT_HELLO, | 1875 | GNUNET_BLOCK_TYPE_DHT_HELLO, |
@@ -1933,16 +1932,16 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender, | |||
1933 | peer = bucket->head; | 1932 | peer = bucket->head; |
1934 | hello = GDS_HELLO_get (peer->id); | 1933 | hello = GDS_HELLO_get (peer->id); |
1935 | } | 1934 | } |
1935 | /* FIXME: this logic is strange. extra ';', maybe, but then why a while-loop at all? */ | ||
1936 | while ((NULL == hello) || | 1936 | while ((NULL == hello) || |
1937 | (GNUNET_BLOCK_EVALUATION_OK_MORE != | 1937 | (GNUNET_BLOCK_REPLY_OK_MORE != |
1938 | GNUNET_BLOCK_evaluate (GDS_block_context, | 1938 | GNUNET_BLOCK_check_reply (GDS_block_context, |
1939 | GNUNET_BLOCK_TYPE_DHT_HELLO, | 1939 | GNUNET_BLOCK_TYPE_DHT_HELLO, |
1940 | bg, | 1940 | bg, |
1941 | GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO, | 1941 | &peer->phash, |
1942 | &peer->phash, | 1942 | NULL, 0, |
1943 | NULL, 0, | 1943 | hello, |
1944 | hello, | 1944 | (hello_size = GNUNET_HELLO_size (hello))))); |
1945 | (hello_size = GNUNET_HELLO_size (hello))))); | ||
1946 | GDS_NEIGHBOURS_handle_reply (sender, | 1945 | GDS_NEIGHBOURS_handle_reply (sender, |
1947 | GNUNET_BLOCK_TYPE_DHT_HELLO, | 1946 | GNUNET_BLOCK_TYPE_DHT_HELLO, |
1948 | GNUNET_TIME_relative_to_absolute | 1947 | GNUNET_TIME_relative_to_absolute |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index e90ba4c8b..8c6c39885 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -395,7 +395,7 @@ client_request_destroy (void *cls) | |||
395 | */ | 395 | */ |
396 | static void | 396 | static void |
397 | client_response_handler (void *cls, | 397 | client_response_handler (void *cls, |
398 | enum GNUNET_BLOCK_EvaluationResult eval, | 398 | enum GNUNET_BLOCK_ReplyEvaluationResult eval, |
399 | struct GSF_PendingRequest *pr, | 399 | struct GSF_PendingRequest *pr, |
400 | uint32_t reply_anonymity_level, | 400 | uint32_t reply_anonymity_level, |
401 | struct GNUNET_TIME_Absolute expiration, | 401 | struct GNUNET_TIME_Absolute expiration, |
@@ -447,7 +447,7 @@ client_response_handler (void *cls, | |||
447 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 447 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
448 | "Queued reply to query `%s' for local client\n", | 448 | "Queued reply to query `%s' for local client\n", |
449 | GNUNET_h2s (&prd->query)); | 449 | GNUNET_h2s (&prd->query)); |
450 | if (GNUNET_BLOCK_EVALUATION_OK_LAST != eval) | 450 | if (GNUNET_BLOCK_REPLY_OK_LAST != eval) |
451 | { | 451 | { |
452 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 452 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
453 | "Evaluation %d - keeping query alive\n", | 453 | "Evaluation %d - keeping query alive\n", |
@@ -668,9 +668,9 @@ consider_request_for_forwarding (void *cls, | |||
668 | void | 668 | void |
669 | GSF_consider_forwarding (void *cls, | 669 | GSF_consider_forwarding (void *cls, |
670 | struct GSF_PendingRequest *pr, | 670 | struct GSF_PendingRequest *pr, |
671 | enum GNUNET_BLOCK_EvaluationResult result) | 671 | enum GNUNET_BLOCK_ReplyEvaluationResult result) |
672 | { | 672 | { |
673 | if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) | 673 | if (GNUNET_BLOCK_REPLY_OK_LAST == result) |
674 | return; /* we're done... */ | 674 | return; /* we're done... */ |
675 | if (GNUNET_YES != | 675 | if (GNUNET_YES != |
676 | GSF_pending_request_test_active_ (pr)) | 676 | GSF_pending_request_test_active_ (pr)) |
@@ -737,13 +737,13 @@ check_p2p_get (void *cls, | |||
737 | static void | 737 | static void |
738 | start_p2p_processing (void *cls, | 738 | start_p2p_processing (void *cls, |
739 | struct GSF_PendingRequest *pr, | 739 | struct GSF_PendingRequest *pr, |
740 | enum GNUNET_BLOCK_EvaluationResult result) | 740 | enum GNUNET_BLOCK_ReplyEvaluationResult result) |
741 | { | 741 | { |
742 | struct GSF_LocalClient *lc = cls; | 742 | struct GSF_LocalClient *lc = cls; |
743 | struct GSF_PendingRequestData *prd; | 743 | struct GSF_PendingRequestData *prd; |
744 | 744 | ||
745 | GNUNET_SERVICE_client_continue (lc->client); | 745 | GNUNET_SERVICE_client_continue (lc->client); |
746 | if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) | 746 | if (GNUNET_BLOCK_REPLY_OK_LAST == result) |
747 | return; /* we're done, 'pr' was already destroyed... */ | 747 | return; /* we're done, 'pr' was already destroyed... */ |
748 | prd = GSF_pending_request_get_data_ (pr); | 748 | prd = GSF_pending_request_get_data_ (pr); |
749 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 749 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h index 9c87115ed..a6b73db09 100644 --- a/src/fs/gnunet-service-fs.h +++ b/src/fs/gnunet-service-fs.h | |||
@@ -280,7 +280,7 @@ extern unsigned int GSF_datastore_queue_size; | |||
280 | void | 280 | void |
281 | GSF_consider_forwarding (void *cls, | 281 | GSF_consider_forwarding (void *cls, |
282 | struct GSF_PendingRequest *pr, | 282 | struct GSF_PendingRequest *pr, |
283 | enum GNUNET_BLOCK_EvaluationResult result); | 283 | enum GNUNET_BLOCK_ReplyEvaluationResult result); |
284 | 284 | ||
285 | 285 | ||
286 | /** | 286 | /** |
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index c174ad611..5476aa2be 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -836,7 +836,7 @@ get_randomized_delay () | |||
836 | */ | 836 | */ |
837 | static void | 837 | static void |
838 | handle_p2p_reply (void *cls, | 838 | handle_p2p_reply (void *cls, |
839 | enum GNUNET_BLOCK_EvaluationResult eval, | 839 | enum GNUNET_BLOCK_ReplyEvaluationResult eval, |
840 | struct GSF_PendingRequest *pr, | 840 | struct GSF_PendingRequest *pr, |
841 | uint32_t reply_anonymity_level, | 841 | uint32_t reply_anonymity_level, |
842 | struct GNUNET_TIME_Absolute expiration, | 842 | struct GNUNET_TIME_Absolute expiration, |
@@ -862,11 +862,11 @@ handle_p2p_reply (void *cls, | |||
862 | return; | 862 | return; |
863 | } | 863 | } |
864 | GNUNET_break (GNUNET_BLOCK_TYPE_ANY != type); | 864 | GNUNET_break (GNUNET_BLOCK_TYPE_ANY != type); |
865 | if ((prd->type != type) && (GNUNET_BLOCK_TYPE_ANY != prd->type)) | 865 | if ( (prd->type != type) && |
866 | (GNUNET_BLOCK_TYPE_ANY != prd->type) ) | ||
866 | { | 867 | { |
867 | GNUNET_STATISTICS_update (GSF_stats, | 868 | GNUNET_STATISTICS_update (GSF_stats, |
868 | gettext_noop | 869 | "# replies dropped due to type mismatch", |
869 | ("# replies dropped due to type mismatch"), | ||
870 | 1, GNUNET_NO); | 870 | 1, GNUNET_NO); |
871 | return; | 871 | return; |
872 | } | 872 | } |
@@ -874,22 +874,22 @@ handle_p2p_reply (void *cls, | |||
874 | "Transmitting result for query `%s' to peer\n", | 874 | "Transmitting result for query `%s' to peer\n", |
875 | GNUNET_h2s (&prd->query)); | 875 | GNUNET_h2s (&prd->query)); |
876 | GNUNET_STATISTICS_update (GSF_stats, | 876 | GNUNET_STATISTICS_update (GSF_stats, |
877 | gettext_noop ("# replies received for other peers"), | 877 | "# replies received for other peers", |
878 | 1, GNUNET_NO); | 878 | 1, |
879 | GNUNET_NO); | ||
879 | msize = sizeof(struct PutMessage) + data_len; | 880 | msize = sizeof(struct PutMessage) + data_len; |
880 | if (msize >= GNUNET_MAX_MESSAGE_SIZE) | 881 | if (msize >= GNUNET_MAX_MESSAGE_SIZE) |
881 | { | 882 | { |
882 | GNUNET_break (0); | 883 | GNUNET_break (0); |
883 | return; | 884 | return; |
884 | } | 885 | } |
885 | if ((UINT32_MAX != reply_anonymity_level) && (reply_anonymity_level > 1)) | 886 | if ( (UINT32_MAX != reply_anonymity_level) && |
887 | (reply_anonymity_level > 1) ) | ||
886 | { | 888 | { |
887 | if (reply_anonymity_level - 1 > GSF_cover_content_count) | 889 | if (reply_anonymity_level - 1 > GSF_cover_content_count) |
888 | { | 890 | { |
889 | GNUNET_STATISTICS_update (GSF_stats, | 891 | GNUNET_STATISTICS_update (GSF_stats, |
890 | gettext_noop | 892 | "# replies dropped due to insufficient cover traffic", |
891 | ( | ||
892 | "# replies dropped due to insufficient cover traffic"), | ||
893 | 1, GNUNET_NO); | 893 | 1, GNUNET_NO); |
894 | return; | 894 | return; |
895 | } | 895 | } |
@@ -930,14 +930,12 @@ handle_p2p_reply (void *cls, | |||
930 | UINT32_MAX, | 930 | UINT32_MAX, |
931 | env); | 931 | env); |
932 | } | 932 | } |
933 | if (GNUNET_BLOCK_EVALUATION_OK_LAST != eval) | 933 | if (GNUNET_BLOCK_REPLY_OK_LAST != eval) |
934 | return; | 934 | return; |
935 | if (NULL == peerreq->kill_task) | 935 | if (NULL == peerreq->kill_task) |
936 | { | 936 | { |
937 | GNUNET_STATISTICS_update (GSF_stats, | 937 | GNUNET_STATISTICS_update (GSF_stats, |
938 | gettext_noop | 938 | "# P2P searches destroyed due to ultimate reply", |
939 | ( | ||
940 | "# P2P searches destroyed due to ultimate reply"), | ||
941 | 1, | 939 | 1, |
942 | GNUNET_NO); | 940 | GNUNET_NO); |
943 | peerreq->kill_task = | 941 | peerreq->kill_task = |
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index a5db4b6b7..c3fe5ff58 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -135,7 +135,7 @@ struct GSF_PendingRequest | |||
135 | /** | 135 | /** |
136 | * Last result from the local datastore lookup evaluation. | 136 | * Last result from the local datastore lookup evaluation. |
137 | */ | 137 | */ |
138 | enum GNUNET_BLOCK_EvaluationResult local_result; | 138 | enum GNUNET_BLOCK_ReplyEvaluationResult local_result; |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * Identity of the peer that we should use for the 'sender' | 141 | * Identity of the peer that we should use for the 'sender' |
@@ -619,7 +619,9 @@ clean_request (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
619 | if (NULL != (cont = pr->llc_cont)) | 619 | if (NULL != (cont = pr->llc_cont)) |
620 | { | 620 | { |
621 | pr->llc_cont = NULL; | 621 | pr->llc_cont = NULL; |
622 | cont (pr->llc_cont_cls, pr, pr->local_result); | 622 | cont (pr->llc_cont_cls, |
623 | pr, | ||
624 | pr->local_result); | ||
623 | } | 625 | } |
624 | GSF_plan_notify_request_done_ (pr); | 626 | GSF_plan_notify_request_done_ (pr); |
625 | GNUNET_free (pr->replies_seen); | 627 | GNUNET_free (pr->replies_seen); |
@@ -689,7 +691,9 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, int full_cleanup) | |||
689 | if (NULL != (cont = pr->llc_cont)) | 691 | if (NULL != (cont = pr->llc_cont)) |
690 | { | 692 | { |
691 | pr->llc_cont = NULL; | 693 | pr->llc_cont = NULL; |
692 | cont (pr->llc_cont_cls, pr, pr->local_result); | 694 | cont (pr->llc_cont_cls, |
695 | pr, | ||
696 | pr->local_result); | ||
693 | } | 697 | } |
694 | GSF_plan_notify_request_done_ (pr); | 698 | GSF_plan_notify_request_done_ (pr); |
695 | if (NULL != pr->qe) | 699 | if (NULL != pr->qe) |
@@ -778,7 +782,7 @@ struct ProcessReplyClosure | |||
778 | /** | 782 | /** |
779 | * Evaluation result (returned). | 783 | * Evaluation result (returned). |
780 | */ | 784 | */ |
781 | enum GNUNET_BLOCK_EvaluationResult eval; | 785 | enum GNUNET_BLOCK_ReplyEvaluationResult eval; |
782 | 786 | ||
783 | /** | 787 | /** |
784 | * Did we find a matching request? | 788 | * Did we find a matching request? |
@@ -814,8 +818,10 @@ update_request_performance_data (struct ProcessReplyClosure *prq, | |||
814 | * @param value value in the hash map (info about the query) | 818 | * @param value value in the hash map (info about the query) |
815 | * @return #GNUNET_YES (we should continue to iterate) | 819 | * @return #GNUNET_YES (we should continue to iterate) |
816 | */ | 820 | */ |
817 | static int | 821 | static enum GNUNET_GenericReturnValue |
818 | process_reply (void *cls, const struct GNUNET_HashCode *key, void *value) | 822 | process_reply (void *cls, |
823 | const struct GNUNET_HashCode *key, | ||
824 | void *value) | ||
819 | { | 825 | { |
820 | struct ProcessReplyClosure *prq = cls; | 826 | struct ProcessReplyClosure *prq = cls; |
821 | struct GSF_PendingRequest *pr = value; | 827 | struct GSF_PendingRequest *pr = value; |
@@ -832,22 +838,20 @@ process_reply (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
832 | gettext_noop ("# replies received and matched"), | 838 | gettext_noop ("# replies received and matched"), |
833 | 1, | 839 | 1, |
834 | GNUNET_NO); | 840 | GNUNET_NO); |
835 | prq->eval = GNUNET_BLOCK_evaluate (GSF_block_ctx, | 841 | prq->eval = GNUNET_BLOCK_check_reply (GSF_block_ctx, |
836 | prq->type, | 842 | prq->type, |
837 | pr->bg, | 843 | pr->bg, |
838 | prq->eo, | 844 | key, |
839 | key, | 845 | NULL, 0, |
840 | NULL, | 846 | prq->data, |
841 | 0, | 847 | prq->size); |
842 | prq->data, | ||
843 | prq->size); | ||
844 | switch (prq->eval) | 848 | switch (prq->eval) |
845 | { | 849 | { |
846 | case GNUNET_BLOCK_EVALUATION_OK_MORE: | 850 | case GNUNET_BLOCK_REPLY_OK_MORE: |
847 | update_request_performance_data (prq, pr); | 851 | update_request_performance_data (prq, pr); |
848 | break; | 852 | break; |
849 | 853 | ||
850 | case GNUNET_BLOCK_EVALUATION_OK_LAST: | 854 | case GNUNET_BLOCK_REPLY_OK_LAST: |
851 | /* short cut: stop processing early, no BF-update, etc. */ | 855 | /* short cut: stop processing early, no BF-update, etc. */ |
852 | update_request_performance_data (prq, pr); | 856 | update_request_performance_data (prq, pr); |
853 | GNUNET_LOAD_update (GSF_rt_entry_lifetime, | 857 | GNUNET_LOAD_update (GSF_rt_entry_lifetime, |
@@ -859,8 +863,7 @@ process_reply (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
859 | .pr_head, | 863 | .pr_head, |
860 | prq->sender, | 864 | prq->sender, |
861 | &last_transmission)) | 865 | &last_transmission)) |
862 | last_transmission.abs_value_us = | 866 | last_transmission = GNUNET_TIME_UNIT_FOREVER_ABS; |
863 | GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; | ||
864 | /* pass on to other peers / local clients */ | 867 | /* pass on to other peers / local clients */ |
865 | pr->rh (pr->rh_cls, | 868 | pr->rh (pr->rh_cls, |
866 | prq->eval, | 869 | prq->eval, |
@@ -872,46 +875,38 @@ process_reply (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
872 | prq->data, | 875 | prq->data, |
873 | prq->size); | 876 | prq->size); |
874 | return GNUNET_YES; | 877 | return GNUNET_YES; |
875 | 878 | case GNUNET_BLOCK_REPLY_OK_DUPLICATE: | |
876 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: | ||
877 | #if INSANE_STATISTICS | 879 | #if INSANE_STATISTICS |
878 | GNUNET_STATISTICS_update (GSF_stats, | 880 | GNUNET_STATISTICS_update (GSF_stats, |
879 | gettext_noop ( | 881 | "# duplicate replies discarded (bloomfilter)", |
880 | "# duplicate replies discarded (bloomfilter)"), | ||
881 | 1, | 882 | 1, |
882 | GNUNET_NO); | 883 | GNUNET_NO); |
883 | #endif | 884 | #endif |
884 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Duplicate response, discarding.\n"); | 885 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
886 | "Duplicate response, discarding.\n"); | ||
885 | return GNUNET_YES; /* duplicate */ | 887 | return GNUNET_YES; /* duplicate */ |
886 | 888 | ||
887 | case GNUNET_BLOCK_EVALUATION_RESULT_IRRELEVANT: | 889 | case GNUNET_BLOCK_REPLY_IRRELEVANT: |
888 | GNUNET_STATISTICS_update (GSF_stats, | 890 | GNUNET_STATISTICS_update (GSF_stats, |
889 | gettext_noop ("# irrelevant replies discarded"), | 891 | "# irrelevant replies discarded", |
890 | 1, | 892 | 1, |
891 | GNUNET_NO); | 893 | GNUNET_NO); |
892 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Irrelevant response, ignoring.\n"); | 894 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
893 | return GNUNET_YES; | 895 | "Irrelevant response, ignoring.\n"); |
894 | |||
895 | case GNUNET_BLOCK_EVALUATION_RESULT_INVALID: | ||
896 | return GNUNET_YES; /* wrong namespace */ | ||
897 | |||
898 | case GNUNET_BLOCK_EVALUATION_REQUEST_VALID: | ||
899 | GNUNET_break (0); | ||
900 | return GNUNET_YES; | 896 | return GNUNET_YES; |
901 | 897 | case GNUNET_BLOCK_REPLY_INVALID: | |
902 | case GNUNET_BLOCK_EVALUATION_REQUEST_INVALID: | ||
903 | GNUNET_break (0); | ||
904 | return GNUNET_YES; | 898 | return GNUNET_YES; |
905 | 899 | case GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED: | |
906 | case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED: | 900 | GNUNET_break (0); /* bad installation? */ |
907 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
908 | _ ("Unsupported block type %u\n"), | ||
909 | prq->type); | ||
910 | return GNUNET_NO; | 901 | return GNUNET_NO; |
911 | } | 902 | } |
912 | /* update bloomfilter */ | 903 | /* update bloomfilter */ |
913 | GNUNET_CRYPTO_hash (prq->data, prq->size, &chash); | 904 | GNUNET_CRYPTO_hash (prq->data, |
914 | GSF_pending_request_update_ (pr, &chash, 1); | 905 | prq->size, |
906 | &chash); | ||
907 | GSF_pending_request_update_ (pr, | ||
908 | &chash, | ||
909 | 1); | ||
915 | if (NULL == prq->sender) | 910 | if (NULL == prq->sender) |
916 | { | 911 | { |
917 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 912 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -936,7 +931,7 @@ process_reply (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
936 | .pr_head, | 931 | .pr_head, |
937 | prq->sender, | 932 | prq->sender, |
938 | &last_transmission)) | 933 | &last_transmission)) |
939 | last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; | 934 | last_transmission = GNUNET_TIME_UNIT_FOREVER_ABS; |
940 | pr->rh (pr->rh_cls, | 935 | pr->rh (pr->rh_cls, |
941 | prq->eval, | 936 | prq->eval, |
942 | pr, | 937 | pr, |
@@ -1363,12 +1358,12 @@ call_continuation (struct GSF_PendingRequest *pr) | |||
1363 | pr->llc_cont = NULL; | 1358 | pr->llc_cont = NULL; |
1364 | if (0 != (GSF_PRO_LOCAL_ONLY & pr->public_data.options)) | 1359 | if (0 != (GSF_PRO_LOCAL_ONLY & pr->public_data.options)) |
1365 | { | 1360 | { |
1366 | if (GNUNET_BLOCK_EVALUATION_OK_LAST != pr->local_result) | 1361 | if (GNUNET_BLOCK_REPLY_OK_LAST != pr->local_result) |
1367 | { | 1362 | { |
1368 | /* Signal that we are done and that there won't be any | 1363 | /* Signal that we are done and that there won't be any |
1369 | additional results to allow client to clean up state. */ | 1364 | additional results to allow client to clean up state. */ |
1370 | pr->rh (pr->rh_cls, | 1365 | pr->rh (pr->rh_cls, |
1371 | GNUNET_BLOCK_EVALUATION_OK_LAST, | 1366 | GNUNET_BLOCK_REPLY_OK_LAST, |
1372 | pr, | 1367 | pr, |
1373 | UINT32_MAX, | 1368 | UINT32_MAX, |
1374 | GNUNET_TIME_UNIT_ZERO_ABS, | 1369 | GNUNET_TIME_UNIT_ZERO_ABS, |
@@ -1380,11 +1375,15 @@ call_continuation (struct GSF_PendingRequest *pr) | |||
1380 | /* Finally, call our continuation to signal that we are | 1375 | /* Finally, call our continuation to signal that we are |
1381 | done with local processing of this request; i.e. to | 1376 | done with local processing of this request; i.e. to |
1382 | start reading again from the client. */ | 1377 | start reading again from the client. */ |
1383 | cont (pr->llc_cont_cls, NULL, GNUNET_BLOCK_EVALUATION_OK_LAST); | 1378 | cont (pr->llc_cont_cls, |
1379 | NULL, | ||
1380 | GNUNET_BLOCK_REPLY_OK_LAST); | ||
1384 | return; | 1381 | return; |
1385 | } | 1382 | } |
1386 | 1383 | ||
1387 | cont (pr->llc_cont_cls, pr, pr->local_result); | 1384 | cont (pr->llc_cont_cls, |
1385 | pr, | ||
1386 | pr->local_result); | ||
1388 | } | 1387 | } |
1389 | 1388 | ||
1390 | 1389 | ||
@@ -1635,7 +1634,7 @@ called_from_on_demand: | |||
1635 | prq.eo = GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO; | 1634 | prq.eo = GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO; |
1636 | process_reply (&prq, key, pr); | 1635 | process_reply (&prq, key, pr); |
1637 | pr->local_result = prq.eval; | 1636 | pr->local_result = prq.eval; |
1638 | if (GNUNET_BLOCK_EVALUATION_OK_LAST == prq.eval) | 1637 | if (GNUNET_BLOCK_REPLY_OK_LAST == prq.eval) |
1639 | { | 1638 | { |
1640 | GNUNET_STATISTICS_update ( | 1639 | GNUNET_STATISTICS_update ( |
1641 | GSF_stats, | 1640 | GSF_stats, |
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index 58fdd334e..a10fb9b4c 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h | |||
@@ -184,16 +184,17 @@ struct GSF_PendingRequestData | |||
184 | * @param data_len number of bytes in @a data | 184 | * @param data_len number of bytes in @a data |
185 | */ | 185 | */ |
186 | typedef void | 186 | typedef void |
187 | (*GSF_PendingRequestReplyHandler) (void *cls, | 187 | (*GSF_PendingRequestReplyHandler) ( |
188 | enum GNUNET_BLOCK_EvaluationResult eval, | 188 | void *cls, |
189 | struct GSF_PendingRequest *pr, | 189 | enum GNUNET_BLOCK_ReplyEvaluationResult eval, |
190 | uint32_t reply_anonymity_level, | 190 | struct GSF_PendingRequest *pr, |
191 | struct GNUNET_TIME_Absolute expiration, | 191 | uint32_t reply_anonymity_level, |
192 | struct GNUNET_TIME_Absolute | 192 | struct GNUNET_TIME_Absolute expiration, |
193 | last_transmission, | 193 | struct GNUNET_TIME_Absolute |
194 | enum GNUNET_BLOCK_Type type, | 194 | last_transmission, |
195 | const void *data, | 195 | enum GNUNET_BLOCK_Type type, |
196 | size_t data_len); | 196 | const void *data, |
197 | size_t data_len); | ||
197 | 198 | ||
198 | 199 | ||
199 | /** | 200 | /** |
@@ -374,9 +375,10 @@ GSF_cadet_lookup_ (struct GSF_PendingRequest *pr); | |||
374 | * @param result final datastore lookup result | 375 | * @param result final datastore lookup result |
375 | */ | 376 | */ |
376 | typedef void | 377 | typedef void |
377 | (*GSF_LocalLookupContinuation) (void *cls, | 378 | (*GSF_LocalLookupContinuation) ( |
378 | struct GSF_PendingRequest *pr, | 379 | void *cls, |
379 | enum GNUNET_BLOCK_EvaluationResult result); | 380 | struct GSF_PendingRequest *pr, |
381 | enum GNUNET_BLOCK_ReplyEvaluationResult result); | ||
380 | 382 | ||
381 | 383 | ||
382 | /** | 384 | /** |
diff --git a/src/fs/test_plugin_block_fs.c b/src/fs/test_plugin_block_fs.c index 4f71c5d74..727cc37c2 100644 --- a/src/fs/test_plugin_block_fs.c +++ b/src/fs/test_plugin_block_fs.c | |||
@@ -34,36 +34,31 @@ test_fs (struct GNUNET_BLOCK_Context *ctx) | |||
34 | 34 | ||
35 | memset (block, 1, sizeof(block)); | 35 | memset (block, 1, sizeof(block)); |
36 | if (GNUNET_OK != | 36 | if (GNUNET_OK != |
37 | GNUNET_BLOCK_get_key (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, block, | 37 | GNUNET_BLOCK_get_key (ctx, |
38 | sizeof(block), &key)) | 38 | GNUNET_BLOCK_TYPE_FS_DBLOCK, |
39 | block, | ||
40 | sizeof(block), | ||
41 | &key)) | ||
39 | return 1; | 42 | return 1; |
40 | if (GNUNET_BLOCK_EVALUATION_OK_LAST != | 43 | if (GNUNET_OK != |
41 | GNUNET_BLOCK_evaluate (ctx, | 44 | GNUNET_BLOCK_check_block (ctx, |
42 | GNUNET_BLOCK_TYPE_FS_DBLOCK, | 45 | GNUNET_BLOCK_TYPE_FS_DBLOCK, |
43 | NULL, | 46 | &key, |
44 | GNUNET_BLOCK_EO_NONE, | 47 | block, |
45 | &key, | 48 | sizeof(block))) |
46 | NULL, 0, | ||
47 | block, sizeof(block))) | ||
48 | return 2; | 49 | return 2; |
49 | if (GNUNET_BLOCK_EVALUATION_REQUEST_VALID != | 50 | if (GNUNET_OK != |
50 | GNUNET_BLOCK_evaluate (ctx, | 51 | GNUNET_BLOCK_check_query (ctx, |
51 | GNUNET_BLOCK_TYPE_FS_DBLOCK, | 52 | GNUNET_BLOCK_TYPE_FS_DBLOCK, |
52 | NULL, | 53 | &key, |
53 | GNUNET_BLOCK_EO_NONE, | 54 | NULL, 0)) |
54 | &key, | ||
55 | NULL, 0, | ||
56 | NULL, 0)) | ||
57 | return 4; | 55 | return 4; |
58 | GNUNET_log_skip (1, GNUNET_NO); | 56 | GNUNET_log_skip (1, GNUNET_NO); |
59 | if (GNUNET_BLOCK_EVALUATION_REQUEST_INVALID != | 57 | if (GNUNET_BLOCK_EVALUATION_REQUEST_INVALID != |
60 | GNUNET_BLOCK_evaluate (ctx, | 58 | GNUNET_BLOCK_check_query (ctx, |
61 | GNUNET_BLOCK_TYPE_FS_DBLOCK, | 59 | GNUNET_BLOCK_TYPE_FS_DBLOCK, |
62 | NULL, | 60 | &key, |
63 | GNUNET_BLOCK_EO_NONE, | 61 | "bogus", 5)) |
64 | &key, | ||
65 | "bogus", 5, | ||
66 | NULL, 0)) | ||
67 | return 8; | 62 | return 8; |
68 | GNUNET_log_skip (0, GNUNET_YES); | 63 | GNUNET_log_skip (0, GNUNET_YES); |
69 | return 0; | 64 | return 0; |