diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-26 00:53:32 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-26 00:53:32 +0000 |
commit | 6342157c3068d482f7f8c02b7229e80eba2c94dc (patch) | |
tree | 3c5b9f1af6637e05471ca3cfae2b268e08f00b2b /src/fs | |
parent | 0cd7408a37d1daefc6394027247b10d0efaae1a3 (diff) | |
download | gnunet-6342157c3068d482f7f8c02b7229e80eba2c94dc.tar.gz gnunet-6342157c3068d482f7f8c02b7229e80eba2c94dc.zip |
potential fix for #4024
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 3 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pe.c | 82 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 42 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.h | 73 |
4 files changed, 139 insertions, 61 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index b4f336a6c..667e4f8ba 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -591,6 +591,9 @@ consider_peer_for_forwarding (void *cls, | |||
591 | struct GSF_ConnectedPeer *cp = cls; | 591 | struct GSF_ConnectedPeer *cp = cls; |
592 | struct GNUNET_PeerIdentity pid; | 592 | struct GNUNET_PeerIdentity pid; |
593 | 593 | ||
594 | if (GNUNET_YES != | ||
595 | GSF_pending_request_test_active_ (pr)) | ||
596 | return GNUNET_YES; /* request is not actually active, skip! */ | ||
594 | GSF_connected_peer_get_identity_ (cp, &pid); | 597 | GSF_connected_peer_get_identity_ (cp, &pid); |
595 | if (GNUNET_YES != | 598 | if (GNUNET_YES != |
596 | GSF_pending_request_test_target_ (pr, &pid)) | 599 | GSF_pending_request_test_target_ (pr, &pid)) |
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index 9743d1cb2..1c4065f70 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c | |||
@@ -371,6 +371,8 @@ get_latest (const struct GSF_RequestPlan *rp) | |||
371 | rprd = GSF_pending_request_get_data_ (ret); | 371 | rprd = GSF_pending_request_get_data_ (ret); |
372 | for (bi = bi->next_PE; NULL != bi; bi = bi->next_PE) | 372 | for (bi = bi->next_PE; NULL != bi; bi = bi->next_PE) |
373 | { | 373 | { |
374 | GNUNET_break (GNUNET_YES == | ||
375 | GSF_pending_request_test_active_ (bi->pr)); | ||
374 | prd = GSF_pending_request_get_data_ (bi->pr); | 376 | prd = GSF_pending_request_get_data_ (bi->pr); |
375 | if (prd->ttl.abs_value_us > rprd->ttl.abs_value_us) | 377 | if (prd->ttl.abs_value_us > rprd->ttl.abs_value_us) |
376 | { | 378 | { |
@@ -433,7 +435,8 @@ transmit_message_callback (void *cls, | |||
433 | return 0; | 435 | return 0; |
434 | } | 436 | } |
435 | /* remove from root, add again elsewhere... */ | 437 | /* remove from root, add again elsewhere... */ |
436 | GNUNET_assert (rp == GNUNET_CONTAINER_heap_remove_root (pp->priority_heap)); | 438 | GNUNET_assert (rp == |
439 | GNUNET_CONTAINER_heap_remove_root (pp->priority_heap)); | ||
437 | rp->hn = NULL; | 440 | rp->hn = NULL; |
438 | rp->last_transmission = GNUNET_TIME_absolute_get (); | 441 | rp->last_transmission = GNUNET_TIME_absolute_get (); |
439 | rp->transmission_counter++; | 442 | rp->transmission_counter++; |
@@ -443,8 +446,8 @@ transmit_message_callback (void *cls, | |||
443 | rp, rp->transmission_counter); | 446 | rp, rp->transmission_counter); |
444 | plan (pp, rp); | 447 | plan (pp, rp); |
445 | GNUNET_STATISTICS_update (GSF_stats, | 448 | GNUNET_STATISTICS_update (GSF_stats, |
446 | gettext_noop | 449 | gettext_noop ("# query messages sent to other peers"), |
447 | ("# query messages sent to other peers"), 1, | 450 | 1, |
448 | GNUNET_NO); | 451 | GNUNET_NO); |
449 | return msize; | 452 | return msize; |
450 | } | 453 | } |
@@ -477,7 +480,9 @@ schedule_peer_transmission (void *cls, | |||
477 | (rp->earliest_transmission).rel_value_us)) | 480 | (rp->earliest_transmission).rel_value_us)) |
478 | { | 481 | { |
479 | GNUNET_assert (rp == GNUNET_CONTAINER_heap_remove_root (pp->delay_heap)); | 482 | GNUNET_assert (rp == GNUNET_CONTAINER_heap_remove_root (pp->delay_heap)); |
480 | rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, rp, rp->priority); | 483 | rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, |
484 | rp, | ||
485 | rp->priority); | ||
481 | } | 486 | } |
482 | if (0 == GNUNET_CONTAINER_heap_get_size (pp->priority_heap)) | 487 | if (0 == GNUNET_CONTAINER_heap_get_size (pp->priority_heap)) |
483 | { | 488 | { |
@@ -512,7 +517,9 @@ schedule_peer_transmission (void *cls, | |||
512 | #endif | 517 | #endif |
513 | /* process from priority heap */ | 518 | /* process from priority heap */ |
514 | rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap); | 519 | rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap); |
515 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing query plan %p\n", rp); | 520 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
521 | "Executing query plan %p\n", | ||
522 | rp); | ||
516 | GNUNET_assert (NULL != rp); | 523 | GNUNET_assert (NULL != rp); |
517 | msize = GSF_pending_request_get_message_ (get_latest (rp), 0, NULL); | 524 | msize = GSF_pending_request_get_message_ (get_latest (rp), 0, NULL); |
518 | pp->pth = | 525 | pp->pth = |
@@ -565,6 +572,8 @@ merge_pr (void *cls, | |||
565 | struct GSF_PendingRequestPlanBijection *bi; | 572 | struct GSF_PendingRequestPlanBijection *bi; |
566 | struct GSF_PendingRequest *latest; | 573 | struct GSF_PendingRequest *latest; |
567 | 574 | ||
575 | GNUNET_break (GNUNET_YES == | ||
576 | GSF_pending_request_test_active_ (mpr->pr)); | ||
568 | if (GNUNET_OK != | 577 | if (GNUNET_OK != |
569 | GSF_pending_request_is_compatible_ (mpr->pr, | 578 | GSF_pending_request_is_compatible_ (mpr->pr, |
570 | rp->pe_head->pr)) | 579 | rp->pe_head->pr)) |
@@ -585,7 +594,8 @@ merge_pr (void *cls, | |||
585 | mpr->merged = GNUNET_YES; | 594 | mpr->merged = GNUNET_YES; |
586 | #if INSANE_STATISTICS | 595 | #if INSANE_STATISTICS |
587 | GNUNET_STATISTICS_update (GSF_stats, | 596 | GNUNET_STATISTICS_update (GSF_stats, |
588 | gettext_noop ("# requests merged"), 1, | 597 | gettext_noop ("# requests merged"), |
598 | 1, | ||
589 | GNUNET_NO); | 599 | GNUNET_NO); |
590 | #endif | 600 | #endif |
591 | latest = get_latest (rp); | 601 | latest = get_latest (rp); |
@@ -595,7 +605,8 @@ merge_pr (void *cls, | |||
595 | #if INSANE_STATISTICS | 605 | #if INSANE_STATISTICS |
596 | GNUNET_STATISTICS_update (GSF_stats, | 606 | GNUNET_STATISTICS_update (GSF_stats, |
597 | gettext_noop ("# requests refreshed"), | 607 | gettext_noop ("# requests refreshed"), |
598 | 1, GNUNET_NO); | 608 | 1, |
609 | GNUNET_NO); | ||
599 | #endif | 610 | #endif |
600 | rp->transmission_counter = 0; /* reset */ | 611 | rp->transmission_counter = 0; /* reset */ |
601 | } | 612 | } |
@@ -620,6 +631,8 @@ GSF_plan_add_ (struct GSF_ConnectedPeer *cp, | |||
620 | struct GSF_PendingRequestPlanBijection *bi; | 631 | struct GSF_PendingRequestPlanBijection *bi; |
621 | struct MergeContext mpc; | 632 | struct MergeContext mpc; |
622 | 633 | ||
634 | GNUNET_assert (GNUNET_YES == | ||
635 | GSF_pending_request_test_active_ (pr)); | ||
623 | GNUNET_assert (NULL != cp); | 636 | GNUNET_assert (NULL != cp); |
624 | id = GSF_connected_peer_get_identity2_ (cp); | 637 | id = GSF_connected_peer_get_identity2_ (cp); |
625 | pp = GNUNET_CONTAINER_multipeermap_get (plans, id); | 638 | pp = GNUNET_CONTAINER_multipeermap_get (plans, id); |
@@ -715,12 +728,19 @@ GSF_plan_notify_peer_disconnect_ (const struct GSF_ConnectedPeer *cp) | |||
715 | { | 728 | { |
716 | GNUNET_break (GNUNET_YES == | 729 | GNUNET_break (GNUNET_YES == |
717 | GNUNET_CONTAINER_multihashmap_remove (pp->plan_map, | 730 | GNUNET_CONTAINER_multihashmap_remove (pp->plan_map, |
718 | get_rp_key (rp), rp)); | 731 | get_rp_key (rp), |
732 | rp)); | ||
719 | while (NULL != (bi = rp->pe_head)) | 733 | while (NULL != (bi = rp->pe_head)) |
720 | { | 734 | { |
721 | GNUNET_CONTAINER_MDLL_remove (PE, rp->pe_head, rp->pe_tail, bi); | 735 | GNUNET_CONTAINER_MDLL_remove (PE, |
736 | rp->pe_head, | ||
737 | rp->pe_tail, | ||
738 | bi); | ||
722 | prd = GSF_pending_request_get_data_ (bi->pr); | 739 | prd = GSF_pending_request_get_data_ (bi->pr); |
723 | GNUNET_CONTAINER_MDLL_remove (PR, prd->pr_head, prd->pr_tail, bi); | 740 | GNUNET_CONTAINER_MDLL_remove (PR, |
741 | prd->pr_head, | ||
742 | prd->pr_tail, | ||
743 | bi); | ||
724 | GNUNET_free (bi); | 744 | GNUNET_free (bi); |
725 | } | 745 | } |
726 | plan_count--; | 746 | plan_count--; |
@@ -731,19 +751,28 @@ GSF_plan_notify_peer_disconnect_ (const struct GSF_ConnectedPeer *cp) | |||
731 | { | 751 | { |
732 | GNUNET_break (GNUNET_YES == | 752 | GNUNET_break (GNUNET_YES == |
733 | GNUNET_CONTAINER_multihashmap_remove (pp->plan_map, | 753 | GNUNET_CONTAINER_multihashmap_remove (pp->plan_map, |
734 | get_rp_key (rp), rp)); | 754 | get_rp_key (rp), |
755 | rp)); | ||
735 | while (NULL != (bi = rp->pe_head)) | 756 | while (NULL != (bi = rp->pe_head)) |
736 | { | 757 | { |
737 | prd = GSF_pending_request_get_data_ (bi->pr); | 758 | prd = GSF_pending_request_get_data_ (bi->pr); |
738 | GNUNET_CONTAINER_MDLL_remove (PE, rp->pe_head, rp->pe_tail, bi); | 759 | GNUNET_CONTAINER_MDLL_remove (PE, |
739 | GNUNET_CONTAINER_MDLL_remove (PR, prd->pr_head, prd->pr_tail, bi); | 760 | rp->pe_head, |
761 | rp->pe_tail, | ||
762 | bi); | ||
763 | GNUNET_CONTAINER_MDLL_remove (PR, | ||
764 | prd->pr_head, | ||
765 | prd->pr_tail, | ||
766 | bi); | ||
740 | GNUNET_free (bi); | 767 | GNUNET_free (bi); |
741 | } | 768 | } |
742 | plan_count--; | 769 | plan_count--; |
743 | GNUNET_free (rp); | 770 | GNUNET_free (rp); |
744 | } | 771 | } |
745 | GNUNET_STATISTICS_set (GSF_stats, gettext_noop ("# query plan entries"), | 772 | GNUNET_STATISTICS_set (GSF_stats, |
746 | plan_count, GNUNET_NO); | 773 | gettext_noop ("# query plan entries"), |
774 | plan_count, | ||
775 | GNUNET_NO); | ||
747 | GNUNET_CONTAINER_heap_destroy (pp->delay_heap); | 776 | GNUNET_CONTAINER_heap_destroy (pp->delay_heap); |
748 | GNUNET_CONTAINER_multihashmap_destroy (pp->plan_map); | 777 | GNUNET_CONTAINER_multihashmap_destroy (pp->plan_map); |
749 | GNUNET_free (pp); | 778 | GNUNET_free (pp); |
@@ -798,23 +827,31 @@ GSF_plan_notify_request_done_ (struct GSF_PendingRequest *pr) | |||
798 | while (NULL != (bi = prd->pr_head)) | 827 | while (NULL != (bi = prd->pr_head)) |
799 | { | 828 | { |
800 | rp = bi->rp; | 829 | rp = bi->rp; |
801 | GNUNET_CONTAINER_MDLL_remove (PR, prd->pr_head, prd->pr_tail, bi); | 830 | GNUNET_CONTAINER_MDLL_remove (PR, |
802 | GNUNET_CONTAINER_MDLL_remove (PE, rp->pe_head, rp->pe_tail, bi); | 831 | prd->pr_head, |
832 | prd->pr_tail, | ||
833 | bi); | ||
834 | GNUNET_CONTAINER_MDLL_remove (PE, | ||
835 | rp->pe_head, | ||
836 | rp->pe_tail, | ||
837 | bi); | ||
838 | GNUNET_assert (bi->pr == pr); | ||
803 | if (NULL == rp->pe_head) | 839 | if (NULL == rp->pe_head) |
804 | { | 840 | { |
805 | GNUNET_CONTAINER_heap_remove_node (rp->hn); | 841 | GNUNET_CONTAINER_heap_remove_node (rp->hn); |
806 | plan_count--; | 842 | plan_count--; |
807 | GNUNET_break (GNUNET_YES == | 843 | GNUNET_break (GNUNET_YES == |
808 | GNUNET_CONTAINER_multihashmap_remove (rp->pp->plan_map, | 844 | GNUNET_CONTAINER_multihashmap_remove (rp->pp->plan_map, |
809 | &GSF_pending_request_get_data_ | 845 | &prd->query, |
810 | (bi->pr)->query, | ||
811 | rp)); | 846 | rp)); |
812 | GNUNET_free (rp); | 847 | GNUNET_free (rp); |
813 | } | 848 | } |
814 | GNUNET_free (bi); | 849 | GNUNET_free (bi); |
815 | } | 850 | } |
816 | GNUNET_STATISTICS_set (GSF_stats, gettext_noop ("# query plan entries"), | 851 | GNUNET_STATISTICS_set (GSF_stats, |
817 | plan_count, GNUNET_NO); | 852 | gettext_noop ("# query plan entries"), |
853 | plan_count, | ||
854 | GNUNET_NO); | ||
818 | } | 855 | } |
819 | 856 | ||
820 | 857 | ||
@@ -824,7 +861,8 @@ GSF_plan_notify_request_done_ (struct GSF_PendingRequest *pr) | |||
824 | void | 861 | void |
825 | GSF_plan_init () | 862 | GSF_plan_init () |
826 | { | 863 | { |
827 | plans = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_YES); | 864 | plans = GNUNET_CONTAINER_multipeermap_create (256, |
865 | GNUNET_YES); | ||
828 | } | 866 | } |
829 | 867 | ||
830 | 868 | ||
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 21b00e80e..fe3f939f9 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -628,7 +628,9 @@ clean_request (void *cls, | |||
628 | if (NULL != (cont = pr->llc_cont)) | 628 | if (NULL != (cont = pr->llc_cont)) |
629 | { | 629 | { |
630 | pr->llc_cont = NULL; | 630 | pr->llc_cont = NULL; |
631 | cont (pr->llc_cont_cls, pr, pr->local_result); | 631 | cont (pr->llc_cont_cls, |
632 | pr, | ||
633 | pr->local_result); | ||
632 | } | 634 | } |
633 | GSF_plan_notify_request_done_ (pr); | 635 | GSF_plan_notify_request_done_ (pr); |
634 | GNUNET_free_non_null (pr->replies_seen); | 636 | GNUNET_free_non_null (pr->replies_seen); |
@@ -666,7 +668,8 @@ clean_request (void *cls, | |||
666 | &pr->public_data.query, | 668 | &pr->public_data.query, |
667 | pr)); | 669 | pr)); |
668 | GNUNET_STATISTICS_update (GSF_stats, | 670 | GNUNET_STATISTICS_update (GSF_stats, |
669 | gettext_noop ("# Pending requests active"), -1, | 671 | gettext_noop ("# Pending requests active"), |
672 | -1, | ||
670 | GNUNET_NO); | 673 | GNUNET_NO); |
671 | GNUNET_free (pr); | 674 | GNUNET_free (pr); |
672 | return GNUNET_YES; | 675 | return GNUNET_YES; |
@@ -687,7 +690,7 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, | |||
687 | 690 | ||
688 | if (NULL == pr_map) | 691 | if (NULL == pr_map) |
689 | return; /* already cleaned up! */ | 692 | return; /* already cleaned up! */ |
690 | if (GNUNET_YES != full_cleanup) | 693 | if (GNUNET_NO == full_cleanup) |
691 | { | 694 | { |
692 | /* make request inactive (we're no longer interested in more results), | 695 | /* make request inactive (we're no longer interested in more results), |
693 | * but do NOT remove from our data-structures, we still need it there | 696 | * but do NOT remove from our data-structures, we still need it there |
@@ -1234,10 +1237,10 @@ cadet_reply_proc (void *cls, | |||
1234 | /* retry -- without delay, as this is non-anonymous | 1237 | /* retry -- without delay, as this is non-anonymous |
1235 | and cadet/cadet connect will take some time anyway */ | 1238 | and cadet/cadet connect will take some time anyway */ |
1236 | pr->cadet_request = GSF_cadet_query (pr->public_data.target, | 1239 | pr->cadet_request = GSF_cadet_query (pr->public_data.target, |
1237 | &pr->public_data.query, | 1240 | &pr->public_data.query, |
1238 | pr->public_data.type, | 1241 | pr->public_data.type, |
1239 | &cadet_reply_proc, | 1242 | &cadet_reply_proc, |
1240 | pr); | 1243 | pr); |
1241 | return; | 1244 | return; |
1242 | } | 1245 | } |
1243 | if (GNUNET_YES != | 1246 | if (GNUNET_YES != |
@@ -1286,10 +1289,10 @@ GSF_cadet_lookup_ (struct GSF_PendingRequest *pr) | |||
1286 | if (NULL != pr->cadet_request) | 1289 | if (NULL != pr->cadet_request) |
1287 | return; | 1290 | return; |
1288 | pr->cadet_request = GSF_cadet_query (pr->public_data.target, | 1291 | pr->cadet_request = GSF_cadet_query (pr->public_data.target, |
1289 | &pr->public_data.query, | 1292 | &pr->public_data.query, |
1290 | pr->public_data.type, | 1293 | pr->public_data.type, |
1291 | &cadet_reply_proc, | 1294 | &cadet_reply_proc, |
1292 | pr); | 1295 | pr); |
1293 | } | 1296 | } |
1294 | 1297 | ||
1295 | 1298 | ||
@@ -1840,6 +1843,19 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, | |||
1840 | 1843 | ||
1841 | 1844 | ||
1842 | /** | 1845 | /** |
1846 | * Check if the given request is still active. | ||
1847 | * | ||
1848 | * @param pr pending request | ||
1849 | * @return #GNUNET_YES if the request is still active | ||
1850 | */ | ||
1851 | int | ||
1852 | GSF_pending_request_test_active_ (struct GSF_PendingRequest *pr) | ||
1853 | { | ||
1854 | return (NULL != pr->rh) ? GNUNET_YES : GNUNET_NO; | ||
1855 | } | ||
1856 | |||
1857 | |||
1858 | /** | ||
1843 | * Setup the subsystem. | 1859 | * Setup the subsystem. |
1844 | */ | 1860 | */ |
1845 | void | 1861 | void |
@@ -1868,7 +1884,9 @@ GSF_pending_request_init_ () | |||
1868 | void | 1884 | void |
1869 | GSF_pending_request_done_ () | 1885 | GSF_pending_request_done_ () |
1870 | { | 1886 | { |
1871 | GNUNET_CONTAINER_multihashmap_iterate (pr_map, &clean_request, NULL); | 1887 | GNUNET_CONTAINER_multihashmap_iterate (pr_map, |
1888 | &clean_request, | ||
1889 | NULL); | ||
1872 | GNUNET_CONTAINER_multihashmap_destroy (pr_map); | 1890 | GNUNET_CONTAINER_multihashmap_destroy (pr_map); |
1873 | pr_map = NULL; | 1891 | pr_map = NULL; |
1874 | GNUNET_CONTAINER_heap_destroy (requests_by_expiration_heap); | 1892 | GNUNET_CONTAINER_heap_destroy (requests_by_expiration_heap); |
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index 547595b67..0be91fec2 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h | |||
@@ -222,16 +222,20 @@ typedef void | |||
222 | struct GSF_PendingRequest * | 222 | struct GSF_PendingRequest * |
223 | GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, | 223 | GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, |
224 | enum GNUNET_BLOCK_Type type, | 224 | enum GNUNET_BLOCK_Type type, |
225 | const struct GNUNET_HashCode * query, | 225 | const struct GNUNET_HashCode *query, |
226 | const struct GNUNET_PeerIdentity *target, | 226 | const struct GNUNET_PeerIdentity *target, |
227 | const char *bf_data, size_t bf_size, | 227 | const char *bf_data, |
228 | uint32_t mingle, uint32_t anonymity_level, | 228 | size_t bf_size, |
229 | uint32_t priority, int32_t ttl, | 229 | uint32_t mingle, |
230 | uint32_t anonymity_level, | ||
231 | uint32_t priority, | ||
232 | int32_t ttl, | ||
230 | GNUNET_PEER_Id sender_pid, | 233 | GNUNET_PEER_Id sender_pid, |
231 | GNUNET_PEER_Id origin_pid, | 234 | GNUNET_PEER_Id origin_pid, |
232 | const struct GNUNET_HashCode * replies_seen, | 235 | const struct GNUNET_HashCode *replies_seen, |
233 | unsigned int replies_seen_count, | 236 | unsigned int replies_seen_count, |
234 | GSF_PendingRequestReplyHandler rh, void *rh_cls); | 237 | GSF_PendingRequestReplyHandler rh, |
238 | void *rh_cls); | ||
235 | 239 | ||
236 | 240 | ||
237 | /** | 241 | /** |
@@ -240,11 +244,11 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, | |||
240 | * | 244 | * |
241 | * @param pr request to update | 245 | * @param pr request to update |
242 | * @param replies_seen hash codes of replies that we've seen | 246 | * @param replies_seen hash codes of replies that we've seen |
243 | * @param replies_seen_count size of the replies_seen array | 247 | * @param replies_seen_count size of the @a replies_seen array |
244 | */ | 248 | */ |
245 | void | 249 | void |
246 | GSF_pending_request_update_ (struct GSF_PendingRequest *pr, | 250 | GSF_pending_request_update_ (struct GSF_PendingRequest *pr, |
247 | const struct GNUNET_HashCode * replies_seen, | 251 | const struct GNUNET_HashCode *replies_seen, |
248 | unsigned int replies_seen_count); | 252 | unsigned int replies_seen_count); |
249 | 253 | ||
250 | 254 | ||
@@ -259,13 +263,23 @@ GSF_pending_request_get_data_ (struct GSF_PendingRequest *pr); | |||
259 | 263 | ||
260 | 264 | ||
261 | /** | 265 | /** |
266 | * Check if the given request is still active. | ||
267 | * | ||
268 | * @param pr pending request | ||
269 | * @return #GNUNET_YES if the request is still active | ||
270 | */ | ||
271 | int | ||
272 | GSF_pending_request_test_active_ (struct GSF_PendingRequest *pr); | ||
273 | |||
274 | |||
275 | /** | ||
262 | * Test if two pending requests are compatible (would generate | 276 | * Test if two pending requests are compatible (would generate |
263 | * the same query modulo filters and should thus be processed | 277 | * the same query modulo filters and should thus be processed |
264 | * jointly). | 278 | * jointly). |
265 | * | 279 | * |
266 | * @param pra a pending request | 280 | * @param pra a pending request |
267 | * @param prb another pending request | 281 | * @param prb another pending request |
268 | * @return GNUNET_OK if the requests are compatible | 282 | * @return #GNUNET_OK if the requests are compatible |
269 | */ | 283 | */ |
270 | int | 284 | int |
271 | GSF_pending_request_is_compatible_ (struct GSF_PendingRequest *pra, | 285 | GSF_pending_request_is_compatible_ (struct GSF_PendingRequest *pra, |
@@ -277,13 +291,14 @@ GSF_pending_request_is_compatible_ (struct GSF_PendingRequest *pra, | |||
277 | * transmission to other peers (or at least determine its size). | 291 | * transmission to other peers (or at least determine its size). |
278 | * | 292 | * |
279 | * @param pr request to generate the message for | 293 | * @param pr request to generate the message for |
280 | * @param buf_size number of bytes available in buf | 294 | * @param buf_size number of bytes available in @a buf |
281 | * @param buf where to copy the message (can be NULL) | 295 | * @param buf where to copy the message (can be NULL) |
282 | * @return number of bytes needed (if buf_size too small) or used | 296 | * @return number of bytes needed (if @a buf_size too small) or used |
283 | */ | 297 | */ |
284 | size_t | 298 | size_t |
285 | GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr, | 299 | GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr, |
286 | size_t buf_size, void *buf); | 300 | size_t buf_size, |
301 | void *buf); | ||
287 | 302 | ||
288 | 303 | ||
289 | /** | 304 | /** |
@@ -293,7 +308,8 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr, | |||
293 | * @param full_cleanup fully purge the request | 308 | * @param full_cleanup fully purge the request |
294 | */ | 309 | */ |
295 | void | 310 | void |
296 | GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, int full_cleanup); | 311 | GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, |
312 | int full_cleanup); | ||
297 | 313 | ||
298 | 314 | ||
299 | /** | 315 | /** |
@@ -303,11 +319,12 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, int full_cleanup); | |||
303 | * @param cls closure | 319 | * @param cls closure |
304 | * @param key query for the request | 320 | * @param key query for the request |
305 | * @param pr handle to the pending request | 321 | * @param pr handle to the pending request |
306 | * @return GNUNET_YES to continue to iterate | 322 | * @return #GNUNET_YES to continue to iterate |
307 | */ | 323 | */ |
308 | typedef int (*GSF_PendingRequestIterator) (void *cls, | 324 | typedef int |
309 | const struct GNUNET_HashCode * key, | 325 | (*GSF_PendingRequestIterator) (void *cls, |
310 | struct GSF_PendingRequest * pr); | 326 | const struct GNUNET_HashCode *key, |
327 | struct GSF_PendingRequest *pr); | ||
311 | 328 | ||
312 | 329 | ||
313 | /** | 330 | /** |
@@ -317,7 +334,8 @@ typedef int (*GSF_PendingRequestIterator) (void *cls, | |||
317 | * @param cls closure for it | 334 | * @param cls closure for it |
318 | */ | 335 | */ |
319 | void | 336 | void |
320 | GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it, void *cls); | 337 | GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it, |
338 | void *cls); | ||
321 | 339 | ||
322 | 340 | ||
323 | /** | 341 | /** |
@@ -329,8 +347,8 @@ GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it, void *cls); | |||
329 | * @param cp the other peer involved (sender or receiver, NULL | 347 | * @param cp the other peer involved (sender or receiver, NULL |
330 | * for loopback messages where we are both sender and receiver) | 348 | * for loopback messages where we are both sender and receiver) |
331 | * @param message the actual message | 349 | * @param message the actual message |
332 | * @return GNUNET_OK if the message was well-formed, | 350 | * @return #GNUNET_OK if the message was well-formed, |
333 | * GNUNET_SYSERR if the message was malformed (close connection, | 351 | * #GNUNET_SYSERR if the message was malformed (close connection, |
334 | * do not cache under any circumstances) | 352 | * do not cache under any circumstances) |
335 | */ | 353 | */ |
336 | int | 354 | int |
@@ -364,10 +382,10 @@ GSF_cadet_lookup_ (struct GSF_PendingRequest *pr); | |||
364 | * @param pr the pending request we were processing | 382 | * @param pr the pending request we were processing |
365 | * @param result final datastore lookup result | 383 | * @param result final datastore lookup result |
366 | */ | 384 | */ |
367 | typedef void (*GSF_LocalLookupContinuation) (void *cls, | 385 | typedef void |
368 | struct GSF_PendingRequest * pr, | 386 | (*GSF_LocalLookupContinuation) (void *cls, |
369 | enum GNUNET_BLOCK_EvaluationResult | 387 | struct GSF_PendingRequest *pr, |
370 | result); | 388 | enum GNUNET_BLOCK_EvaluationResult result); |
371 | 389 | ||
372 | 390 | ||
373 | /** | 391 | /** |
@@ -375,11 +393,12 @@ typedef void (*GSF_LocalLookupContinuation) (void *cls, | |||
375 | * | 393 | * |
376 | * @param pr the pending request to process | 394 | * @param pr the pending request to process |
377 | * @param cont function to call at the end | 395 | * @param cont function to call at the end |
378 | * @param cont_cls closure for cont | 396 | * @param cont_cls closure for @a cont |
379 | */ | 397 | */ |
380 | void | 398 | void |
381 | GSF_local_lookup_ (struct GSF_PendingRequest *pr, | 399 | GSF_local_lookup_ (struct GSF_PendingRequest *pr, |
382 | GSF_LocalLookupContinuation cont, void *cont_cls); | 400 | GSF_LocalLookupContinuation cont, |
401 | void *cont_cls); | ||
383 | 402 | ||
384 | 403 | ||
385 | /** | 404 | /** |
@@ -387,7 +406,7 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr, | |||
387 | * | 406 | * |
388 | * @param pr request | 407 | * @param pr request |
389 | * @param target | 408 | * @param target |
390 | * @return GNUNET_YES if this request could be forwarded to the given peer | 409 | * @return #GNUNET_YES if this request could be forwarded to the given peer |
391 | */ | 410 | */ |
392 | int | 411 | int |
393 | GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr, | 412 | GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr, |