diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-12 00:03:49 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-12 00:03:49 +0000 |
commit | 1224b6d62b7214a4afca27695ff7d789fb6f93d3 (patch) | |
tree | 66fb08633714e7e0eab91df29ca12e7a7d95f8b9 /src/fs/fs_api.h | |
parent | 9a112a7aa7c1703a9489da7306293ee1b9df7331 (diff) | |
download | gnunet-1224b6d62b7214a4afca27695ff7d789fb6f93d3.tar.gz gnunet-1224b6d62b7214a4afca27695ff7d789fb6f93d3.zip |
start fewer FS probes concurrently, run them all in the same task to avoid undue pressure on the scheduler
Diffstat (limited to 'src/fs/fs_api.h')
-rw-r--r-- | src/fs/fs_api.h | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h index d43da2028..46f398e86 100644 --- a/src/fs/fs_api.h +++ b/src/fs/fs_api.h | |||
@@ -531,6 +531,16 @@ struct GNUNET_FS_SearchResult | |||
531 | struct GNUNET_FS_Handle *h; | 531 | struct GNUNET_FS_Handle *h; |
532 | 532 | ||
533 | /** | 533 | /** |
534 | * Kept in a DLL while probing. | ||
535 | */ | ||
536 | struct GNUNET_FS_SearchResult *next; | ||
537 | |||
538 | /** | ||
539 | * Kept in a DLL while probing. | ||
540 | */ | ||
541 | struct GNUNET_FS_SearchResult *prev; | ||
542 | |||
543 | /** | ||
534 | * Search context this result belongs to; can be NULL | 544 | * Search context this result belongs to; can be NULL |
535 | * for probes that come from a directory result. | 545 | * for probes that come from a directory result. |
536 | */ | 546 | */ |
@@ -592,12 +602,6 @@ struct GNUNET_FS_SearchResult | |||
592 | GNUNET_SCHEDULER_TaskIdentifier probe_cancel_task; | 602 | GNUNET_SCHEDULER_TaskIdentifier probe_cancel_task; |
593 | 603 | ||
594 | /** | 604 | /** |
595 | * Task we use to report periodically to the application that the | ||
596 | * probe is still running. | ||
597 | */ | ||
598 | GNUNET_SCHEDULER_TaskIdentifier probe_ping_task; | ||
599 | |||
600 | /** | ||
601 | * When did the current probe become active? | 605 | * When did the current probe become active? |
602 | */ | 606 | */ |
603 | struct GNUNET_TIME_Absolute probe_active_time; | 607 | struct GNUNET_TIME_Absolute probe_active_time; |
@@ -651,8 +655,11 @@ struct GNUNET_FS_SearchResult | |||
651 | * @return queue handle | 655 | * @return queue handle |
652 | */ | 656 | */ |
653 | struct GNUNET_FS_QueueEntry * | 657 | struct GNUNET_FS_QueueEntry * |
654 | GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, GNUNET_FS_QueueStart start, | 658 | GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, |
655 | GNUNET_FS_QueueStop stop, void *cls, unsigned int blocks, | 659 | GNUNET_FS_QueueStart start, |
660 | GNUNET_FS_QueueStop stop, | ||
661 | void *cls, | ||
662 | unsigned int blocks, | ||
656 | enum GNUNET_FS_QueuePriority priority); | 663 | enum GNUNET_FS_QueuePriority priority); |
657 | 664 | ||
658 | 665 | ||
@@ -903,7 +910,8 @@ GNUNET_FS_remove_sync_file_ (struct GNUNET_FS_Handle *h, const char *ext, | |||
903 | * @param uni unique name of parent | 910 | * @param uni unique name of parent |
904 | */ | 911 | */ |
905 | void | 912 | void |
906 | GNUNET_FS_remove_sync_dir_ (struct GNUNET_FS_Handle *h, const char *ext, | 913 | GNUNET_FS_remove_sync_dir_ (struct GNUNET_FS_Handle *h, |
914 | const char *ext, | ||
907 | const char *uni); | 915 | const char *uni); |
908 | 916 | ||
909 | 917 | ||
@@ -1003,7 +1011,7 @@ GNUNET_FS_search_signal_suspend_ (void *cls); | |||
1003 | * Create SUSPEND event for the given download operation | 1011 | * Create SUSPEND event for the given download operation |
1004 | * and then clean up our state (without stop signal). | 1012 | * and then clean up our state (without stop signal). |
1005 | * | 1013 | * |
1006 | * @param cls the 'struct GNUNET_FS_DownloadContext' to signal for | 1014 | * @param cls the `struct GNUNET_FS_DownloadContext` to signal for |
1007 | */ | 1015 | */ |
1008 | void | 1016 | void |
1009 | GNUNET_FS_download_signal_suspend_ (void *cls); | 1017 | GNUNET_FS_download_signal_suspend_ (void *cls); |
@@ -1138,12 +1146,28 @@ struct GNUNET_FS_Handle | |||
1138 | struct GNUNET_FS_QueueEntry *pending_tail; | 1146 | struct GNUNET_FS_QueueEntry *pending_tail; |
1139 | 1147 | ||
1140 | /** | 1148 | /** |
1149 | * Head of active probes. | ||
1150 | */ | ||
1151 | struct GNUNET_FS_SearchResult *probes_head; | ||
1152 | |||
1153 | /** | ||
1154 | * Tail of active probes. | ||
1155 | */ | ||
1156 | struct GNUNET_FS_SearchResult *probes_tail; | ||
1157 | |||
1158 | /** | ||
1141 | * Task that processes the jobs in the running and pending queues | 1159 | * Task that processes the jobs in the running and pending queues |
1142 | * (and moves jobs around as needed). | 1160 | * (and moves jobs around as needed). |
1143 | */ | 1161 | */ |
1144 | GNUNET_SCHEDULER_TaskIdentifier queue_job; | 1162 | GNUNET_SCHEDULER_TaskIdentifier queue_job; |
1145 | 1163 | ||
1146 | /** | 1164 | /** |
1165 | * Task we use to report periodically to the application that | ||
1166 | * certain search probes (from @e probes_head) are still running. | ||
1167 | */ | ||
1168 | GNUNET_SCHEDULER_TaskIdentifier probe_ping_task; | ||
1169 | |||
1170 | /** | ||
1147 | * Average time we take for a single request to be satisfied. | 1171 | * Average time we take for a single request to be satisfied. |
1148 | * FIXME: not yet calcualted properly... | 1172 | * FIXME: not yet calcualted properly... |
1149 | */ | 1173 | */ |
@@ -1563,7 +1587,7 @@ struct GNUNET_FS_SearchContext | |||
1563 | char *emsg; | 1587 | char *emsg; |
1564 | 1588 | ||
1565 | /** | 1589 | /** |
1566 | * Map that contains a "struct GNUNET_FS_SearchResult" for each result that | 1590 | * Map that contains a `struct GNUNET_FS_SearchResult` for each result that |
1567 | * was found in the search. The key for each entry is the XOR of | 1591 | * was found in the search. The key for each entry is the XOR of |
1568 | * the key and query in the CHK URI (as a unique identifier for the | 1592 | * the key and query in the CHK URI (as a unique identifier for the |
1569 | * search result). | 1593 | * search result). |
@@ -1769,6 +1793,15 @@ GNUNET_FS_free_download_request_ (struct DownloadRequest *dr); | |||
1769 | 1793 | ||
1770 | 1794 | ||
1771 | /** | 1795 | /** |
1796 | * Stop the ping task for this search result. | ||
1797 | * | ||
1798 | * @param sr result to start pinging for. | ||
1799 | */ | ||
1800 | void | ||
1801 | GNUNET_FS_stop_probe_ping_task_ (struct GNUNET_FS_SearchResult *sr); | ||
1802 | |||
1803 | |||
1804 | /** | ||
1772 | * Context for controlling a download. | 1805 | * Context for controlling a download. |
1773 | */ | 1806 | */ |
1774 | struct GNUNET_FS_DownloadContext | 1807 | struct GNUNET_FS_DownloadContext |
@@ -1912,7 +1945,7 @@ struct GNUNET_FS_DownloadContext | |||
1912 | /** | 1945 | /** |
1913 | * ID of a task that is using this struct and that must be cancelled | 1946 | * ID of a task that is using this struct and that must be cancelled |
1914 | * when the download is being stopped (if not | 1947 | * when the download is being stopped (if not |
1915 | * GNUNET_SCHEDULER_NO_TASK). Used for the task that adds some | 1948 | * #GNUNET_SCHEDULER_NO_TASK). Used for the task that adds some |
1916 | * artificial delay when trying to reconnect to the FS service or | 1949 | * artificial delay when trying to reconnect to the FS service or |
1917 | * the task processing incrementally the data on disk, or the | 1950 | * the task processing incrementally the data on disk, or the |
1918 | * task requesting blocks, etc. | 1951 | * task requesting blocks, etc. |