aboutsummaryrefslogtreecommitdiff
path: root/src/fs
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
parent78469082de0b7fa49724504b7e21bb2e9b4bef05 (diff)
downloadgnunet-390a68296dd89f61461bdca02060d36e2e02af2b.tar.gz
gnunet-390a68296dd89f61461bdca02060d36e2e02af2b.zip
adapt to new API
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/gnunet-service-fs.c18
-rw-r--r--src/fs/gnunet-service-fs_cp.c7
-rw-r--r--src/fs/gnunet-service-fs_lc.c20
-rw-r--r--src/fs/gnunet-service-fs_pr.c53
-rw-r--r--src/fs/gnunet-service-fs_pr.h6
-rw-r--r--src/fs/gnunet-service-fs_push.c6
-rw-r--r--src/fs/gnunet-service-fs_put.c2
7 files changed, 35 insertions, 77 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index ab16bc834..687f131d1 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -1297,7 +1297,7 @@ process_migration_content (void *cls,
1297 MIN_MIGRATION_CONTENT_LIFETIME.rel_value) 1297 MIN_MIGRATION_CONTENT_LIFETIME.rel_value)
1298 { 1298 {
1299 /* content will expire soon, don't bother */ 1299 /* content will expire soon, don't bother */
1300 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 1300 GNUNET_DATASTORE_get_next (dsh);
1301 return; 1301 return;
1302 } 1302 }
1303 if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND) 1303 if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND)
@@ -1309,7 +1309,7 @@ process_migration_content (void *cls,
1309 &process_migration_content, 1309 &process_migration_content,
1310 NULL)) 1310 NULL))
1311 { 1311 {
1312 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 1312 GNUNET_DATASTORE_get_next (dsh);
1313 } 1313 }
1314 return; 1314 return;
1315 } 1315 }
@@ -1333,7 +1333,7 @@ process_migration_content (void *cls,
1333 GNUNET_CONTAINER_multihashmap_iterate (connected_peers, 1333 GNUNET_CONTAINER_multihashmap_iterate (connected_peers,
1334 &consider_migration, 1334 &consider_migration,
1335 mb); 1335 mb);
1336 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 1336 GNUNET_DATASTORE_get_next (dsh);
1337} 1337}
1338 1338
1339 1339
@@ -1344,7 +1344,7 @@ static void
1344dht_put_continuation (void *cls, 1344dht_put_continuation (void *cls,
1345 const struct GNUNET_SCHEDULER_TaskContext *tc) 1345 const struct GNUNET_SCHEDULER_TaskContext *tc)
1346{ 1346{
1347 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 1347 GNUNET_DATASTORE_get_next (dsh);
1348} 1348}
1349 1349
1350 1350
@@ -3984,7 +3984,7 @@ process_local_reply (void *cls,
3984 pr)) 3984 pr))
3985 if (pr->qe != NULL) 3985 if (pr->qe != NULL)
3986 { 3986 {
3987 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 3987 GNUNET_DATASTORE_get_next (dsh);
3988 } 3988 }
3989 return; 3989 return;
3990 } 3990 }
@@ -4007,7 +4007,7 @@ process_local_reply (void *cls,
4007 -1, -1, 4007 -1, -1,
4008 GNUNET_TIME_UNIT_FOREVER_REL, 4008 GNUNET_TIME_UNIT_FOREVER_REL,
4009 NULL, NULL); 4009 NULL, NULL);
4010 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 4010 GNUNET_DATASTORE_get_next (dsh);
4011 return; 4011 return;
4012 } 4012 }
4013 prq.type = type; 4013 prq.type = type;
@@ -4026,7 +4026,7 @@ process_local_reply (void *cls,
4026 if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST) 4026 if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST)
4027 { 4027 {
4028 pr->local_only = GNUNET_YES; /* do not forward */ 4028 pr->local_only = GNUNET_YES; /* do not forward */
4029 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); 4029 GNUNET_DATASTORE_get_next (dsh);
4030 return; 4030 return;
4031 } 4031 }
4032 if ( (pr->client_request_list == NULL) && 4032 if ( (pr->client_request_list == NULL) &&
@@ -4041,10 +4041,10 @@ process_local_reply (void *cls,
4041 gettext_noop ("# processing result set cut short due to load"), 4041 gettext_noop ("# processing result set cut short due to load"),
4042 1, 4042 1,
4043 GNUNET_NO); 4043 GNUNET_NO);
4044 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); 4044 GNUNET_DATASTORE_get_next (dsh);
4045 return; 4045 return;
4046 } 4046 }
4047 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 4047 GNUNET_DATASTORE_get_next (dsh);
4048} 4048}
4049 4049
4050 4050
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index c4e82350f..9ff96ba36 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -562,17 +562,13 @@ copy_reply (void *cls,
562 * @param expiration when does 'data' expire? 562 * @param expiration when does 'data' expire?
563 * @param data response data, NULL on request expiration 563 * @param data response data, NULL on request expiration
564 * @param data_len number of bytes in data 564 * @param data_len number of bytes in data
565 * @param more GNUNET_YES if the request remains active (may call
566 * this function again), GNUNET_NO if the request is
567 * finished (client must not call GSF_pending_request_cancel_)
568 */ 565 */
569static void 566static void
570handle_p2p_reply (void *cls, 567handle_p2p_reply (void *cls,
571 struct GSF_PendingRequest *pr, 568 struct GSF_PendingRequest *pr,
572 struct GNUNET_TIME_Absolute expiration, 569 struct GNUNET_TIME_Absolute expiration,
573 const void *data, 570 const void *data,
574 size_t data_len, 571 size_t data_len)
575 int more)
576{ 572{
577 struct GSF_ConnectedPeer *cp = cls; 573 struct GSF_ConnectedPeer *cp = cls;
578 struct GSF_PendingRequestData *prd; 574 struct GSF_PendingRequestData *prd;
@@ -582,7 +578,6 @@ handle_p2p_reply (void *cls,
582 prd = GSF_pending_request_get_data_ (pr); 578 prd = GSF_pending_request_get_data_ (pr);
583 if (NULL == data) 579 if (NULL == data)
584 { 580 {
585 GNUNET_assert (GNUNET_NO == more);
586 GNUNET_STATISTICS_update (GSF_stats, 581 GNUNET_STATISTICS_update (GSF_stats,
587 gettext_noop ("# P2P searches active"), 582 gettext_noop ("# P2P searches active"),
588 -1, 583 -1,
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c
index 8727670e8..5ceb7c2a5 100644
--- a/src/fs/gnunet-service-fs_lc.c
+++ b/src/fs/gnunet-service-fs_lc.c
@@ -192,17 +192,13 @@ GSF_local_client_lookup_ (struct GNUNET_SERVER_Client *client)
192 * @param expiration when does 'data' expire? 192 * @param expiration when does 'data' expire?
193 * @param data response data, NULL on request expiration 193 * @param data response data, NULL on request expiration
194 * @param data_len number of bytes in data 194 * @param data_len number of bytes in data
195 * @param more GNUNET_YES if the request remains active (may call
196 * this function again), GNUNET_NO if the request is
197 * finished (client must not call GSF_pending_request_cancel_)
198 */ 195 */
199static void 196static void
200client_response_handler (void *cls, 197client_response_handler (void *cls,
201 struct GSF_PendingRequest *pr, 198 struct GSF_PendingRequest *pr,
202 struct GNUNET_TIME_Absolute expiration, 199 struct GNUNET_TIME_Absolute expiration,
203 const void *data, 200 const void *data,
204 size_t data_len, 201 size_t data_len)
205 int more)
206{ 202{
207 struct ClientRequest *cr = cls; 203 struct ClientRequest *cr = cls;
208 struct GSF_LocalClient *lc; 204 struct GSF_LocalClient *lc;
@@ -214,7 +210,6 @@ client_response_handler (void *cls,
214 { 210 {
215 /* ugh, request 'timed out' -- how can this be? */ 211 /* ugh, request 'timed out' -- how can this be? */
216 GNUNET_break (0); 212 GNUNET_break (0);
217 GNUNET_assert (GNUNET_NO == more);
218 return; 213 return;
219 } 214 }
220 GNUNET_STATISTICS_update (GSF_stats, 215 GNUNET_STATISTICS_update (GSF_stats,
@@ -238,19 +233,6 @@ client_response_handler (void *cls,
238 GNUNET_h2s (&prd->query), 233 GNUNET_h2s (&prd->query),
239 (unsigned int) prd->type); 234 (unsigned int) prd->type);
240#endif 235#endif
241 if (GNUNET_NO == more)
242 {
243 GNUNET_CONTAINER_DLL_remove (lc->cr_head,
244 lc->cr_tail,
245 cr);
246 GNUNET_SERVER_receive_done (lc->client,
247 GNUNET_OK);
248 GNUNET_STATISTICS_update (GSF_stats,
249 gettext_noop ("# client searches active"),
250 - 1,
251 GNUNET_NO);
252 GNUNET_free (cr);
253 }
254} 236}
255 237
256 238
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,
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h
index a25659e22..ea464e578 100644
--- a/src/fs/gnunet-service-fs_pr.h
+++ b/src/fs/gnunet-service-fs_pr.h
@@ -162,16 +162,12 @@ struct GSF_PendingRequestData
162 * @param expiration when does 'data' expire? 162 * @param expiration when does 'data' expire?
163 * @param data response data, NULL on request expiration 163 * @param data response data, NULL on request expiration
164 * @param data_len number of bytes in data 164 * @param data_len number of bytes in data
165 * @param more GNUNET_YES if the request remains active (may call
166 * this function again), GNUNET_NO if the request is
167 * finished (client must not call GSF_pending_request_cancel_)
168 */ 165 */
169typedef void (*GSF_PendingRequestReplyHandler)(void *cls, 166typedef void (*GSF_PendingRequestReplyHandler)(void *cls,
170 struct GSF_PendingRequest *pr, 167 struct GSF_PendingRequest *pr,
171 struct GNUNET_TIME_Absolute expiration, 168 struct GNUNET_TIME_Absolute expiration,
172 const void *data, 169 const void *data,
173 size_t data_len, 170 size_t data_len);
174 int more);
175 171
176 172
177/** 173/**
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c
index da781bc07..e720f392f 100644
--- a/src/fs/gnunet-service-fs_push.c
+++ b/src/fs/gnunet-service-fs_push.c
@@ -479,7 +479,7 @@ process_migration_content (void *cls,
479 MIN_MIGRATION_CONTENT_LIFETIME.rel_value) 479 MIN_MIGRATION_CONTENT_LIFETIME.rel_value)
480 { 480 {
481 /* content will expire soon, don't bother */ 481 /* content will expire soon, don't bother */
482 GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); 482 GNUNET_DATASTORE_get_next (GSF_dsh);
483 return; 483 return;
484 } 484 }
485 if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND) 485 if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND)
@@ -491,7 +491,7 @@ process_migration_content (void *cls,
491 &process_migration_content, 491 &process_migration_content,
492 NULL)) 492 NULL))
493 { 493 {
494 GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); 494 GNUNET_DATASTORE_get_next (GSF_dsh);
495 } 495 }
496 return; 496 return;
497 } 497 }
@@ -522,7 +522,7 @@ process_migration_content (void *cls,
522 } 522 }
523 pos = pos->next; 523 pos = pos->next;
524 } 524 }
525 GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); 525 GNUNET_DATASTORE_get_next (GSF_dsh);
526} 526}
527 527
528 528
diff --git a/src/fs/gnunet-service-fs_put.c b/src/fs/gnunet-service-fs_put.c
index 97a7a90b5..5fd2ce81c 100644
--- a/src/fs/gnunet-service-fs_put.c
+++ b/src/fs/gnunet-service-fs_put.c
@@ -109,7 +109,7 @@ static void
109dht_put_continuation (void *cls, 109dht_put_continuation (void *cls,
110 const struct GNUNET_SCHEDULER_TaskContext *tc) 110 const struct GNUNET_SCHEDULER_TaskContext *tc)
111{ 111{
112 GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); 112 GNUNET_DATASTORE_get_next (GSF_dsh);
113} 113}
114 114
115 115