diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-03-10 17:34:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-03-10 17:34:42 +0000 |
commit | e87e273ce5f864e20fcca02c34bef72de4fc00bd (patch) | |
tree | 14125cc08e325f9133d4a7a8b43b7de5f7fece94 /src/fs | |
parent | e253ed6e7e5ac2a113b6dbc762258f358c9ca5ae (diff) | |
download | gnunet-e87e273ce5f864e20fcca02c34bef72de4fc00bd.tar.gz gnunet-e87e273ce5f864e20fcca02c34bef72de4fc00bd.zip |
load
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 1 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.h | 23 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_cp.c | 31 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_lc.c | 4 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_new.c | 68 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 106 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.h | 6 |
7 files changed, 146 insertions, 93 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index a9a3b7c5f..cbfac9322 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -955,6 +955,7 @@ static unsigned int cover_content_count; | |||
955 | */ | 955 | */ |
956 | static GNUNET_SCHEDULER_TaskIdentifier cover_age_task; | 956 | static GNUNET_SCHEDULER_TaskIdentifier cover_age_task; |
957 | 957 | ||
958 | |||
958 | static void | 959 | static void |
959 | age_cover_counters (void *cls, | 960 | age_cover_counters (void *cls, |
960 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 961 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h index db9de3cb8..a82206e9c 100644 --- a/src/fs/gnunet-service-fs.h +++ b/src/fs/gnunet-service-fs.h | |||
@@ -126,13 +126,34 @@ extern unsigned int GSF_cover_query_count; | |||
126 | */ | 126 | */ |
127 | extern unsigned int GSF_cover_content_count; | 127 | extern unsigned int GSF_cover_content_count; |
128 | 128 | ||
129 | |||
130 | /** | 129 | /** |
131 | * Our block context. | 130 | * Our block context. |
132 | */ | 131 | */ |
133 | extern struct GNUNET_BLOCK_Context *GSF_block_ctx; | 132 | extern struct GNUNET_BLOCK_Context *GSF_block_ctx; |
134 | 133 | ||
135 | 134 | ||
135 | /** | ||
136 | * Test if the DATABASE (GET) load on this peer is too high | ||
137 | * to even consider processing the query at | ||
138 | * all. | ||
139 | * | ||
140 | * @return GNUNET_YES if the load is too high to do anything (load high) | ||
141 | * GNUNET_NO to process normally (load normal) | ||
142 | * GNUNET_SYSERR to process for free (load low) | ||
143 | */ | ||
144 | int | ||
145 | GSF_test_get_load_too_high_ (uint32_t priority); | ||
146 | |||
147 | |||
148 | /** | ||
149 | * We've just now completed a datastore request. Update our | ||
150 | * datastore load calculations. | ||
151 | * | ||
152 | * @param start time when the datastore request was issued | ||
153 | */ | ||
154 | void | ||
155 | GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start); | ||
156 | |||
136 | 157 | ||
137 | 158 | ||
138 | #endif | 159 | #endif |
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 407c9f7fe..6e39d7bd2 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -618,33 +618,6 @@ handle_p2p_reply (void *cls, | |||
618 | 618 | ||
619 | 619 | ||
620 | /** | 620 | /** |
621 | * Test if the DATABASE (GET) load on this peer is too high | ||
622 | * to even consider processing the query at | ||
623 | * all. | ||
624 | * | ||
625 | * @return GNUNET_YES if the load is too high to do anything (load high) | ||
626 | * GNUNET_NO to process normally (load normal) | ||
627 | * GNUNET_SYSERR to process for free (load low) | ||
628 | */ | ||
629 | static int | ||
630 | test_get_load_too_high (uint32_t priority) | ||
631 | { | ||
632 | #if FIXME_later | ||
633 | double ld; | ||
634 | |||
635 | ld = GNUNET_LOAD_get_load (datastore_get_load); | ||
636 | if (ld < 1) | ||
637 | return GNUNET_SYSERR; | ||
638 | if (ld <= priority) | ||
639 | return GNUNET_NO; | ||
640 | return GNUNET_YES; | ||
641 | #else | ||
642 | return GNUNET_SYSERR; | ||
643 | #endif | ||
644 | } | ||
645 | |||
646 | |||
647 | /** | ||
648 | * Increase the host credit by a value. | 621 | * Increase the host credit by a value. |
649 | * | 622 | * |
650 | * @param cp which peer to change the trust value on | 623 | * @param cp which peer to change the trust value on |
@@ -699,7 +672,7 @@ bound_priority (uint32_t prio_in, | |||
699 | double rret; | 672 | double rret; |
700 | int ld; | 673 | int ld; |
701 | 674 | ||
702 | ld = test_get_load_too_high (0); | 675 | ld = GSF_test_get_load_too_high_ (0); |
703 | if (ld == GNUNET_SYSERR) | 676 | if (ld == GNUNET_SYSERR) |
704 | { | 677 | { |
705 | GNUNET_STATISTICS_update (GSF_stats, | 678 | GNUNET_STATISTICS_update (GSF_stats, |
@@ -723,7 +696,7 @@ bound_priority (uint32_t prio_in, | |||
723 | if ( (ld == GNUNET_YES) && (ret > 0) ) | 696 | if ( (ld == GNUNET_YES) && (ret > 0) ) |
724 | { | 697 | { |
725 | /* try with charging */ | 698 | /* try with charging */ |
726 | ld = test_get_load_too_high (ret); | 699 | ld = GSF_test_get_load_too_high_ (ret); |
727 | } | 700 | } |
728 | if (ld == GNUNET_YES) | 701 | if (ld == GNUNET_YES) |
729 | { | 702 | { |
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c index f284ba0f8..d5b6f4297 100644 --- a/src/fs/gnunet-service-fs_lc.c +++ b/src/fs/gnunet-service-fs_lc.c | |||
@@ -292,6 +292,10 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, | |||
292 | (type == GNUNET_BLOCK_TYPE_FS_NBLOCK) || | 292 | (type == GNUNET_BLOCK_TYPE_FS_NBLOCK) || |
293 | (type == GNUNET_BLOCK_TYPE_ANY) ) | 293 | (type == GNUNET_BLOCK_TYPE_ANY) ) |
294 | { | 294 | { |
295 | /* FIXME: this does currently not work to filter duplicate | ||
296 | results from *local* datastore since the local store is | ||
297 | queried before we continue to process additional | ||
298 | messages from the client! -- fix protocol? */ | ||
295 | cr = lc->cr_head; | 299 | cr = lc->cr_head; |
296 | while (cr != NULL) | 300 | while (cr != NULL) |
297 | { | 301 | { |
diff --git a/src/fs/gnunet-service-fs_new.c b/src/fs/gnunet-service-fs_new.c index 4b22a0c52..7ad1874f7 100644 --- a/src/fs/gnunet-service-fs_new.c +++ b/src/fs/gnunet-service-fs_new.c | |||
@@ -70,6 +70,13 @@ | |||
70 | */ | 70 | */ |
71 | #define COVER_AGE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) | 71 | #define COVER_AGE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
72 | 72 | ||
73 | /** | ||
74 | * At what frequency should our datastore load decrease | ||
75 | * automatically (since if we don't use it, clearly the | ||
76 | * load must be going down). | ||
77 | */ | ||
78 | #define DATASTORE_LOAD_AUTODECLINE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250) | ||
79 | |||
73 | 80 | ||
74 | /* ****************************** globals ****************************** */ | 81 | /* ****************************** globals ****************************** */ |
75 | 82 | ||
@@ -153,6 +160,11 @@ static GNUNET_SCHEDULER_TaskIdentifier cover_age_task; | |||
153 | static struct GNUNET_CORE_Handle *core; | 160 | static struct GNUNET_CORE_Handle *core; |
154 | 161 | ||
155 | /** | 162 | /** |
163 | * Datastore 'GET' load tracking. | ||
164 | */ | ||
165 | static struct GNUNET_LOAD_Value *datastore_get_load; | ||
166 | |||
167 | /** | ||
156 | * Identity of this peer. | 168 | * Identity of this peer. |
157 | */ | 169 | */ |
158 | static struct GNUNET_PeerIdentity my_id; | 170 | static struct GNUNET_PeerIdentity my_id; |
@@ -175,6 +187,50 @@ age_cover_counters (void *cls, | |||
175 | } | 187 | } |
176 | 188 | ||
177 | 189 | ||
190 | |||
191 | /** | ||
192 | * We've just now completed a datastore request. Update our | ||
193 | * datastore load calculations. | ||
194 | * | ||
195 | * @param start time when the datastore request was issued | ||
196 | */ | ||
197 | void | ||
198 | GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start) | ||
199 | { | ||
200 | struct GNUNET_TIME_Relative delay; | ||
201 | |||
202 | delay = GNUNET_TIME_absolute_get_duration (start); | ||
203 | GNUNET_LOAD_update (datastore_get_load, | ||
204 | delay.rel_value); | ||
205 | } | ||
206 | |||
207 | |||
208 | /** | ||
209 | * Test if the DATABASE (GET) load on this peer is too high | ||
210 | * to even consider processing the query at | ||
211 | * all. | ||
212 | * | ||
213 | * @return GNUNET_YES if the load is too high to do anything (load high) | ||
214 | * GNUNET_NO to process normally (load normal) | ||
215 | * GNUNET_SYSERR to process for free (load low) | ||
216 | */ | ||
217 | int | ||
218 | GSF_test_get_load_too_high_ (uint32_t priority) | ||
219 | { | ||
220 | double ld; | ||
221 | |||
222 | ld = GNUNET_LOAD_get_load (datastore_get_load); | ||
223 | if (ld < 1) | ||
224 | return GNUNET_SYSERR; | ||
225 | if (ld <= priority) | ||
226 | return GNUNET_NO; | ||
227 | return GNUNET_YES; | ||
228 | } | ||
229 | |||
230 | |||
231 | |||
232 | |||
233 | |||
178 | /** | 234 | /** |
179 | * Handle P2P "PUT" message. | 235 | * Handle P2P "PUT" message. |
180 | * | 236 | * |
@@ -311,11 +367,18 @@ start_p2p_processing (void *cls, | |||
311 | enum GNUNET_BLOCK_EvaluationResult result) | 367 | enum GNUNET_BLOCK_EvaluationResult result) |
312 | { | 368 | { |
313 | struct GNUNET_SERVER_Client *client = cls; | 369 | struct GNUNET_SERVER_Client *client = cls; |
370 | struct GSF_PendingRequestData *prd; | ||
314 | 371 | ||
315 | GNUNET_SERVER_receive_done (client, | 372 | GNUNET_SERVER_receive_done (client, |
316 | GNUNET_OK); | 373 | GNUNET_OK); |
317 | if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) | 374 | if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) |
318 | return; /* we're done... */ | 375 | return; /* we're done, 'pr' was already destroyed... */ |
376 | prd = GSF_pending_request_get_data_ (pr); | ||
377 | if (0 != (GSF_PRO_LOCAL_ONLY & prd->options) ) | ||
378 | { | ||
379 | GSF_pending_request_cancel_ (pr); | ||
380 | return; | ||
381 | } | ||
319 | GSF_dht_lookup_ (pr); | 382 | GSF_dht_lookup_ (pr); |
320 | consider_forwarding (NULL, pr, result); | 383 | consider_forwarding (NULL, pr, result); |
321 | } | 384 | } |
@@ -381,6 +444,8 @@ shutdown_task (void *cls, | |||
381 | GNUNET_SCHEDULER_cancel (cover_age_task); | 444 | GNUNET_SCHEDULER_cancel (cover_age_task); |
382 | cover_age_task = GNUNET_SCHEDULER_NO_TASK; | 445 | cover_age_task = GNUNET_SCHEDULER_NO_TASK; |
383 | } | 446 | } |
447 | GNUNET_LOAD_value_free (datastore_get_load); | ||
448 | datastore_get_load = NULL; | ||
384 | } | 449 | } |
385 | 450 | ||
386 | 451 | ||
@@ -512,6 +577,7 @@ main_init (struct GNUNET_SERVER_Handle *server, | |||
512 | cover_age_task = GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, | 577 | cover_age_task = GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, |
513 | &age_cover_counters, | 578 | &age_cover_counters, |
514 | NULL); | 579 | NULL); |
580 | datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); | ||
515 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 581 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
516 | &shutdown_task, | 582 | &shutdown_task, |
517 | NULL); | 583 | NULL); |
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 58af8be65..0fdcd0cf1 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_load_lib.h" | 27 | #include "gnunet_load_lib.h" |
28 | #include "gnunet-service-fs_cp.h" | 28 | #include "gnunet-service-fs_cp.h" |
29 | #include "gnunet-service-fs_indexing.h" | ||
29 | #include "gnunet-service-fs_pr.h" | 30 | #include "gnunet-service-fs_pr.h" |
30 | 31 | ||
31 | 32 | ||
@@ -75,6 +76,22 @@ struct GSF_PendingRequest | |||
75 | struct GNUNET_DHT_GetHandle *gh; | 76 | struct GNUNET_DHT_GetHandle *gh; |
76 | 77 | ||
77 | /** | 78 | /** |
79 | * Function to call upon completion of the local get | ||
80 | * request, or NULL for none. | ||
81 | */ | ||
82 | GSF_LocalLookupContinuation llc_cont; | ||
83 | |||
84 | /** | ||
85 | * Closure for llc_cont. | ||
86 | */ | ||
87 | void *llc_cont_cls; | ||
88 | |||
89 | /** | ||
90 | * Last result from the local datastore lookup evaluation. | ||
91 | */ | ||
92 | enum GNUNET_BLOCK_EvaluationResult local_result; | ||
93 | |||
94 | /** | ||
78 | * Identity of the peer that we should use for the 'sender' | 95 | * Identity of the peer that we should use for the 'sender' |
79 | * (recipient of the response) when forwarding (0 for none). | 96 | * (recipient of the response) when forwarding (0 for none). |
80 | */ | 97 | */ |
@@ -683,6 +700,7 @@ process_reply (void *cls, | |||
683 | prq->data, prq->size, | 700 | prq->data, prq->size, |
684 | GNUNET_NO); | 701 | GNUNET_NO); |
685 | /* destroy request, we're done */ | 702 | /* destroy request, we're done */ |
703 | prq->finished = GNUNET_YES; | ||
686 | GSF_pending_request_cancel_ (pr); | 704 | GSF_pending_request_cancel_ (pr); |
687 | return GNUNET_YES; | 705 | return GNUNET_YES; |
688 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: | 706 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: |
@@ -909,14 +927,13 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr) | |||
909 | pr); | 927 | pr); |
910 | } | 928 | } |
911 | 929 | ||
912 | |||
913 | /** | 930 | /** |
914 | * We're processing (local) results for a search request | 931 | * We're processing (local) results for a search request |
915 | * from another peer. Pass applicable results to the | 932 | * from another peer. Pass applicable results to the |
916 | * peer and if we are done either clean up (operation | 933 | * peer and if we are done either clean up (operation |
917 | * complete) or forward to other peers (more results possible). | 934 | * complete) or forward to other peers (more results possible). |
918 | * | 935 | * |
919 | * @param cls our closure (struct LocalGetContext) | 936 | * @param cls our closure (struct PendingRequest) |
920 | * @param key key for the content | 937 | * @param key key for the content |
921 | * @param size number of bytes in data | 938 | * @param size number of bytes in data |
922 | * @param data content stored | 939 | * @param data content stored |
@@ -938,53 +955,23 @@ process_local_reply (void *cls, | |||
938 | struct GNUNET_TIME_Absolute expiration, | 955 | struct GNUNET_TIME_Absolute expiration, |
939 | uint64_t uid) | 956 | uint64_t uid) |
940 | { | 957 | { |
941 | #if FIXME | 958 | struct GSF_PendingRequest *pr = cls; |
942 | struct PendingRequest *pr = cls; | 959 | GSF_LocalLookupContinuation cont; |
960 | |||
943 | struct ProcessReplyClosure prq; | 961 | struct ProcessReplyClosure prq; |
944 | struct CheckDuplicateRequestClosure cdrc; | ||
945 | GNUNET_HashCode query; | 962 | GNUNET_HashCode query; |
946 | unsigned int old_rf; | 963 | unsigned int old_rf; |
947 | 964 | ||
948 | if (NULL == key) | 965 | if (NULL == key) |
949 | { | 966 | { |
950 | #if DEBUG_FS > 1 | ||
951 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
952 | "Done processing local replies, forwarding request to other peers.\n"); | ||
953 | #endif | ||
954 | pr->qe = NULL; | 967 | pr->qe = NULL; |
955 | if (pr->client_request_list != NULL) | 968 | if (NULL != (cont = pr->llc_cont)) |
956 | { | ||
957 | GNUNET_SERVER_receive_done (pr->client_request_list->client_list->client, | ||
958 | GNUNET_YES); | ||
959 | /* Figure out if this is a duplicate request and possibly | ||
960 | merge 'struct PendingRequest' entries */ | ||
961 | cdrc.have = NULL; | ||
962 | cdrc.pr = pr; | ||
963 | GNUNET_CONTAINER_multihashmap_get_multiple (query_request_map, | ||
964 | &pr->query, | ||
965 | &check_duplicate_request_client, | ||
966 | &cdrc); | ||
967 | if (cdrc.have != NULL) | ||
968 | { | ||
969 | #if DEBUG_FS | ||
970 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
971 | "Received request for block `%s' twice from client, will only request once.\n", | ||
972 | GNUNET_h2s (&pr->query)); | ||
973 | #endif | ||
974 | |||
975 | destroy_pending_request (pr); | ||
976 | return; | ||
977 | } | ||
978 | } | ||
979 | if (pr->local_only == GNUNET_YES) | ||
980 | { | 969 | { |
981 | destroy_pending_request (pr); | 970 | pr->llc_cont = NULL; |
982 | return; | 971 | cont (pr->llc_cont_cls, |
972 | pr, | ||
973 | pr->local_result); | ||
983 | } | 974 | } |
984 | /* no more results */ | ||
985 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) | ||
986 | pr->task = GNUNET_SCHEDULER_add_now (&forward_request_task, | ||
987 | pr); | ||
988 | return; | 975 | return; |
989 | } | 976 | } |
990 | #if DEBUG_FS | 977 | #if DEBUG_FS |
@@ -999,7 +986,7 @@ process_local_reply (void *cls, | |||
999 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 986 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1000 | "Found ONDEMAND block, performing on-demand encoding\n"); | 987 | "Found ONDEMAND block, performing on-demand encoding\n"); |
1001 | #endif | 988 | #endif |
1002 | GNUNET_STATISTICS_update (stats, | 989 | GNUNET_STATISTICS_update (GSF_stats, |
1003 | gettext_noop ("# on-demand blocks matched requests"), | 990 | gettext_noop ("# on-demand blocks matched requests"), |
1004 | 1, | 991 | 1, |
1005 | GNUNET_NO); | 992 | GNUNET_NO); |
@@ -1008,32 +995,32 @@ process_local_reply (void *cls, | |||
1008 | anonymity, expiration, uid, | 995 | anonymity, expiration, uid, |
1009 | &process_local_reply, | 996 | &process_local_reply, |
1010 | pr)) | 997 | pr)) |
1011 | if (pr->qe != NULL) | ||
1012 | { | 998 | { |
1013 | GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); | 999 | if (pr->qe != NULL) |
1000 | GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); | ||
1014 | } | 1001 | } |
1015 | return; | 1002 | return; |
1016 | } | 1003 | } |
1017 | old_rf = pr->results_found; | 1004 | old_rf = pr->public_data.results_found; |
1018 | memset (&prq, 0, sizeof (prq)); | 1005 | memset (&prq, 0, sizeof (prq)); |
1019 | prq.data = data; | 1006 | prq.data = data; |
1020 | prq.expiration = expiration; | 1007 | prq.expiration = expiration; |
1021 | prq.size = size; | 1008 | prq.size = size; |
1022 | if (GNUNET_OK != | 1009 | if (GNUNET_OK != |
1023 | GNUNET_BLOCK_get_key (block_ctx, | 1010 | GNUNET_BLOCK_get_key (GSF_block_ctx, |
1024 | type, | 1011 | type, |
1025 | data, | 1012 | data, |
1026 | size, | 1013 | size, |
1027 | &query)) | 1014 | &query)) |
1028 | { | 1015 | { |
1029 | GNUNET_break (0); | 1016 | GNUNET_break (0); |
1030 | GNUNET_DATASTORE_remove (dsh, | 1017 | GNUNET_DATASTORE_remove (GSF_dsh, |
1031 | key, | 1018 | key, |
1032 | size, data, | 1019 | size, data, |
1033 | -1, -1, | 1020 | -1, -1, |
1034 | GNUNET_TIME_UNIT_FOREVER_REL, | 1021 | GNUNET_TIME_UNIT_FOREVER_REL, |
1035 | NULL, NULL); | 1022 | NULL, NULL); |
1036 | GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); | 1023 | GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); |
1037 | return; | 1024 | return; |
1038 | } | 1025 | } |
1039 | prq.type = type; | 1026 | prq.type = type; |
@@ -1042,36 +1029,35 @@ process_local_reply (void *cls, | |||
1042 | prq.request_found = GNUNET_NO; | 1029 | prq.request_found = GNUNET_NO; |
1043 | prq.anonymity_level = anonymity; | 1030 | prq.anonymity_level = anonymity; |
1044 | if ( (old_rf == 0) && | 1031 | if ( (old_rf == 0) && |
1045 | (pr->results_found == 0) ) | 1032 | (pr->public_data.results_found == 0) ) |
1046 | update_datastore_delays (pr->start_time); | 1033 | GSF_update_datastore_delay_ (pr->public_data.start_time); |
1047 | process_reply (&prq, key, pr); | 1034 | process_reply (&prq, key, pr); |
1048 | if (prq.finished == GNUNET_YES) | 1035 | if (prq.finished == GNUNET_YES) |
1049 | return; | 1036 | return; |
1037 | pr->local_result = prq.eval; | ||
1050 | if (pr->qe == NULL) | 1038 | if (pr->qe == NULL) |
1051 | return; /* done here */ | 1039 | return; /* done here */ |
1052 | if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST) | 1040 | if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST) |
1053 | { | 1041 | { |
1054 | pr->local_only = GNUNET_YES; /* do not forward */ | 1042 | GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_NO); |
1055 | GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); | ||
1056 | return; | 1043 | return; |
1057 | } | 1044 | } |
1058 | if ( (pr->client_request_list == NULL) && | 1045 | if ( (0 == (GSF_PRO_PRIORITY_UNLIMITED & pr->public_data.options)) && |
1059 | ( (GNUNET_YES == test_get_load_too_high (0)) || | 1046 | ( (GNUNET_YES == GSF_test_get_load_too_high_ (0)) || |
1060 | (pr->results_found > 5 + 2 * pr->priority) ) ) | 1047 | (pr->public_data.results_found > 5 + 2 * pr->public_data.priority) ) ) |
1061 | { | 1048 | { |
1062 | #if DEBUG_FS > 2 | 1049 | #if DEBUG_FS > 2 |
1063 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1050 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1064 | "Load too high, done with request\n"); | 1051 | "Load too high, done with request\n"); |
1065 | #endif | 1052 | #endif |
1066 | GNUNET_STATISTICS_update (stats, | 1053 | GNUNET_STATISTICS_update (GSF_stats, |
1067 | gettext_noop ("# processing result set cut short due to load"), | 1054 | gettext_noop ("# processing result set cut short due to load"), |
1068 | 1, | 1055 | 1, |
1069 | GNUNET_NO); | 1056 | GNUNET_NO); |
1070 | GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); | 1057 | GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_NO); |
1071 | return; | 1058 | return; |
1072 | } | 1059 | } |
1073 | GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); | 1060 | GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); |
1074 | #endif | ||
1075 | } | 1061 | } |
1076 | 1062 | ||
1077 | 1063 | ||
@@ -1087,8 +1073,10 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr, | |||
1087 | GSF_LocalLookupContinuation cont, | 1073 | GSF_LocalLookupContinuation cont, |
1088 | void *cont_cls) | 1074 | void *cont_cls) |
1089 | { | 1075 | { |
1090 | // FIXME: fix process_local_reply / cont! | ||
1091 | GNUNET_assert (NULL == pr->gh); | 1076 | GNUNET_assert (NULL == pr->gh); |
1077 | GNUNET_assert (NULL == pr->llc_cont); | ||
1078 | pr->llc_cont = cont; | ||
1079 | pr->llc_cont_cls = cont_cls; | ||
1092 | pr->qe = GNUNET_DATASTORE_get (GSF_dsh, | 1080 | pr->qe = GNUNET_DATASTORE_get (GSF_dsh, |
1093 | &pr->public_data.query, | 1081 | &pr->public_data.query, |
1094 | pr->public_data.type, | 1082 | pr->public_data.type, |
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index 39a5fc77f..885947295 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h | |||
@@ -315,9 +315,9 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr); | |||
315 | * @param pr the pending request we were processing | 315 | * @param pr the pending request we were processing |
316 | * @param result final datastore lookup result | 316 | * @param result final datastore lookup result |
317 | */ | 317 | */ |
318 | typedef void (GSF_LocalLookupContinuation)(void *cls, | 318 | typedef void (*GSF_LocalLookupContinuation)(void *cls, |
319 | struct GSF_PendingRequest *pr, | 319 | struct GSF_PendingRequest *pr, |
320 | enum GNUNET_BLOCK_EvaluationResult result); | 320 | enum GNUNET_BLOCK_EvaluationResult result); |
321 | 321 | ||
322 | 322 | ||
323 | /** | 323 | /** |