View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003545 | GNUnet | file-sharing service | public | 2014-09-29 02:10 | 2018-06-07 00:25 |
| Reporter | bratao | Assigned To | Christian Grothoff | ||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | closed | Resolution | fixed | ||
| Platform | W32 | OS | Windows | OS Version | 8.1 |
| Product Version | Git master | ||||
| Target Version | 0.11.0pre66 | Fixed in Version | 0.11.0pre66 | ||
| Summary | 0003545: Add resume/suspend functionalty to download | ||||
| Description | One should be able to pause and resume a download. I attached a patch that implement this. Please check if I implemented it correctly. | ||||
| Tags | No tags attached. | ||||
| Attached Files | resume-suspend-download.patch (1,860 bytes)
Index: src/fs/fs_download.c
===================================================================
--- src/fs/fs_download.c (revision 34309)
+++ src/fs/fs_download.c (working copy)
@@ -2291,8 +2291,41 @@
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).
*
* @param dc handle for the download
Index: src/include/gnunet_fs_service.h
===================================================================
--- src/include/gnunet_fs_service.h (revision 34309)
+++ src/include/gnunet_fs_service.h (working copy)
@@ -2451,7 +2451,25 @@
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 *********************** */
| ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2014-09-29 02:10 | bratao | New Issue | |
| 2014-09-29 02:10 | bratao | File Added: resume-suspend-download.patch | |
| 2014-10-02 10:23 | Christian Grothoff | Note Added: 0008593 | |
| 2014-10-02 10:23 | Christian Grothoff | Status | new => resolved |
| 2014-10-02 10:23 | Christian Grothoff | Fixed in Version | => 0.11.0pre66 |
| 2014-10-02 10:23 | Christian Grothoff | Resolution | open => fixed |
| 2014-10-02 10:23 | Christian Grothoff | Assigned To | => Christian Grothoff |
| 2014-10-02 10:23 | Christian Grothoff | Target Version | => 0.11.0pre66 |
| 2018-06-07 00:25 | Christian Grothoff | Status | resolved => closed |