aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_pr.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-03-25 08:49:47 +0000
committerChristian Grothoff <christian@grothoff.org>2011-03-25 08:49:47 +0000
commit390a68296dd89f61461bdca02060d36e2e02af2b (patch)
tree9aa86841d2052cdd4080f6a4e2003313bf9670bf /src/fs/gnunet-service-fs_pr.c
parent78469082de0b7fa49724504b7e21bb2e9b4bef05 (diff)
downloadgnunet-390a68296dd89f61461bdca02060d36e2e02af2b.tar.gz
gnunet-390a68296dd89f61461bdca02060d36e2e02af2b.zip
adapt to new API
Diffstat (limited to 'src/fs/gnunet-service-fs_pr.c')
-rw-r--r--src/fs/gnunet-service-fs_pr.c53
1 files changed, 19 insertions, 34 deletions
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index c3116ba23..13de31c7c 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -333,8 +333,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
333 dpr->rh (dpr->rh_cls, 333 dpr->rh (dpr->rh_cls,
334 dpr, 334 dpr,
335 GNUNET_TIME_UNIT_FOREVER_ABS, 335 GNUNET_TIME_UNIT_FOREVER_ABS,
336 NULL, 0, 336 NULL, 0);
337 GNUNET_SYSERR);
338 GSF_pending_request_cancel_ (dpr); 337 GSF_pending_request_cancel_ (dpr);
339 } 338 }
340 } 339 }
@@ -618,11 +617,6 @@ struct ProcessReplyClosure
618 enum GNUNET_BLOCK_EvaluationResult eval; 617 enum GNUNET_BLOCK_EvaluationResult eval;
619 618
620 /** 619 /**
621 * Did we finish processing the associated request?
622 */
623 int finished;
624
625 /**
626 * Did we find a matching request? 620 * Did we find a matching request?
627 */ 621 */
628 int request_found; 622 int request_found;
@@ -698,11 +692,7 @@ process_reply (void *cls,
698 pr->rh (pr->rh_cls, 692 pr->rh (pr->rh_cls,
699 pr, 693 pr,
700 prq->expiration, 694 prq->expiration,
701 prq->data, prq->size, 695 prq->data, prq->size);
702 GNUNET_NO);
703 /* destroy request, we're done */
704 prq->finished = GNUNET_YES;
705 GSF_pending_request_cancel_ (pr);
706 return GNUNET_YES; 696 return GNUNET_YES;
707 case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: 697 case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
708 GNUNET_STATISTICS_update (GSF_stats, 698 GNUNET_STATISTICS_update (GSF_stats,
@@ -759,8 +749,7 @@ process_reply (void *cls,
759 pr->rh (pr->rh_cls, 749 pr->rh (pr->rh_cls,
760 pr, 750 pr,
761 prq->expiration, 751 prq->expiration,
762 prq->data, prq->size, 752 prq->data, prq->size);
763 GNUNET_YES);
764 return GNUNET_YES; 753 return GNUNET_YES;
765} 754}
766 755
@@ -958,13 +947,16 @@ process_local_reply (void *cls,
958{ 947{
959 struct GSF_PendingRequest *pr = cls; 948 struct GSF_PendingRequest *pr = cls;
960 GSF_LocalLookupContinuation cont; 949 GSF_LocalLookupContinuation cont;
961
962 struct ProcessReplyClosure prq; 950 struct ProcessReplyClosure prq;
963 GNUNET_HashCode query; 951 GNUNET_HashCode query;
964 unsigned int old_rf; 952 unsigned int old_rf;
965 953
966 if (NULL == key) 954 if (NULL == key)
967 { 955 {
956#if DEBUG_FS
957 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
958 "No further local repsonses available.\n");
959#endif
968 pr->qe = NULL; 960 pr->qe = NULL;
969 if (NULL != (cont = pr->llc_cont)) 961 if (NULL != (cont = pr->llc_cont))
970 { 962 {
@@ -998,7 +990,7 @@ process_local_reply (void *cls,
998 pr)) 990 pr))
999 { 991 {
1000 if (pr->qe != NULL) 992 if (pr->qe != NULL)
1001 GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); 993 GNUNET_DATASTORE_get_next (GSF_dsh);
1002 } 994 }
1003 return; 995 return;
1004 } 996 }
@@ -1021,26 +1013,17 @@ process_local_reply (void *cls,
1021 -1, -1, 1013 -1, -1,
1022 GNUNET_TIME_UNIT_FOREVER_REL, 1014 GNUNET_TIME_UNIT_FOREVER_REL,
1023 NULL, NULL); 1015 NULL, NULL);
1024 GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); 1016 GNUNET_DATASTORE_get_next (GSF_dsh);
1025 return; 1017 return;
1026 } 1018 }
1027 prq.type = type; 1019 prq.type = type;
1028 prq.priority = priority; 1020 prq.priority = priority;
1029 prq.finished = GNUNET_NO;
1030 prq.request_found = GNUNET_NO; 1021 prq.request_found = GNUNET_NO;
1031 prq.anonymity_level = anonymity; 1022 prq.anonymity_level = anonymity;
1032 if ( (old_rf == 0) && 1023 if ( (old_rf == 0) &&
1033 (pr->public_data.results_found == 0) ) 1024 (pr->public_data.results_found == 0) )
1034 GSF_update_datastore_delay_ (pr->public_data.start_time); 1025 GSF_update_datastore_delay_ (pr->public_data.start_time);
1035 process_reply (&prq, key, pr); 1026 process_reply (&prq, key, pr);
1036 if (prq.finished == GNUNET_YES)
1037 {
1038#if DEBUG_FS
1039 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1040 "Request processing finished, not asking datastore for more\n");
1041#endif
1042 return;
1043 }
1044 pr->local_result = prq.eval; 1027 pr->local_result = prq.eval;
1045 if (pr->qe == NULL) 1028 if (pr->qe == NULL)
1046 { 1029 {
@@ -1049,11 +1032,6 @@ process_local_reply (void *cls,
1049 "Request cancelled, not asking datastore for more\n"); 1032 "Request cancelled, not asking datastore for more\n");
1050#endif 1033#endif
1051 } 1034 }
1052 if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST)
1053 {
1054 GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_NO);
1055 return;
1056 }
1057 if ( (0 == (GSF_PRO_PRIORITY_UNLIMITED & pr->public_data.options)) && 1035 if ( (0 == (GSF_PRO_PRIORITY_UNLIMITED & pr->public_data.options)) &&
1058 ( (GNUNET_YES == GSF_test_get_load_too_high_ (0)) || 1036 ( (GNUNET_YES == GSF_test_get_load_too_high_ (0)) ||
1059 (pr->public_data.results_found > 5 + 2 * pr->public_data.priority) ) ) 1037 (pr->public_data.results_found > 5 + 2 * pr->public_data.priority) ) )
@@ -1066,10 +1044,18 @@ process_local_reply (void *cls,
1066 gettext_noop ("# processing result set cut short due to load"), 1044 gettext_noop ("# processing result set cut short due to load"),
1067 1, 1045 1,
1068 GNUNET_NO); 1046 GNUNET_NO);
1069 GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_NO); 1047 GNUNET_DATASTORE_cancel (pr->qe);
1048 pr->qe = NULL;
1049 if (NULL != (cont = pr->llc_cont))
1050 {
1051 pr->llc_cont = NULL;
1052 cont (pr->llc_cont_cls,
1053 pr,
1054 pr->local_result);
1055 }
1070 return; 1056 return;
1071 } 1057 }
1072 GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); 1058 GNUNET_DATASTORE_get_next (GSF_dsh);
1073} 1059}
1074 1060
1075 1061
@@ -1162,7 +1148,6 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1162 prq.expiration = expiration; 1148 prq.expiration = expiration;
1163 prq.priority = 0; 1149 prq.priority = 0;
1164 prq.anonymity_level = 1; 1150 prq.anonymity_level = 1;
1165 prq.finished = GNUNET_NO;
1166 prq.request_found = GNUNET_NO; 1151 prq.request_found = GNUNET_NO;
1167 GNUNET_CONTAINER_multihashmap_get_multiple (pr_map, 1152 GNUNET_CONTAINER_multihashmap_get_multiple (pr_map,
1168 &query, 1153 &query,