gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit 78f5d7d58f696abf22263d4da685d65f551b4750
parent 081437a43321f7b2cca009bbade4caf379fdb7bc
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  2 Oct 2014 08:22:47 +0000

bratao's patch for #3545: suspend/resume of downloads

Diffstat:
Msrc/fs/fs_download.c | 33+++++++++++++++++++++++++++++++++
Msrc/include/gnunet_fs_service.h | 18++++++++++++++++++
2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c @@ -2291,6 +2291,39 @@ GNUNET_FS_download_start_downloading_ (struct GNUNET_FS_DownloadContext *dc) dc->job_queue); } +/** + * Suspend a download. + * + * @param dc handle for the download + */ +void +GNUNET_FS_download_suspend (struct GNUNET_FS_DownloadContext *dc) +{ + deactivate_fs_download(dc); +} + +/** + * Resume a suspended download. + * + * @param dc handle for the download + */ +void +GNUNET_FS_download_resume (struct GNUNET_FS_DownloadContext *dc) +{ + struct GNUNET_FS_ProgressInfo pi; + + pi.status = GNUNET_FS_STATUS_DOWNLOAD_ACTIVE; + GNUNET_FS_download_make_status_ (&pi, dc); + + dc->job_queue = + GNUNET_FS_queue_ (dc->h, &activate_fs_download, &deactivate_fs_download, + dc, (dc->length + DBLOCK_SIZE - 1) / DBLOCK_SIZE, + (0 == (dc->options & GNUNET_FS_DOWNLOAD_IS_PROBE)) + ? GNUNET_FS_QUEUE_PRIORITY_NORMAL + : GNUNET_FS_QUEUE_PRIORITY_PROBE); + +} + /** * Stop a download (aborts if download is incomplete). diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h @@ -2451,6 +2451,24 @@ void GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, int do_delete); +/** + * Suspend a download. + * + * @param dc handle for the download + */ +void +GNUNET_FS_download_suspend (struct GNUNET_FS_DownloadContext *dc); + + +/** + * Resume a suspended download. + * + * @param dc handle for the download + */ +void +GNUNET_FS_download_resume (struct GNUNET_FS_DownloadContext *dc); + + /* ******************** Directory API *********************** */