View Issue Details

IDProjectCategoryView StatusLast Update
0003545GNUnetfile-sharing servicepublic2018-06-07 00:25
Reporterbratao Assigned ToChristian Grothoff  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
PlatformW32OSWindowsOS Version8.1
Product VersionGit master 
Target Version0.11.0pre66Fixed in Version0.11.0pre66 
Summary0003545: Add resume/suspend functionalty to download
DescriptionOne should be able to pause and resume a download.

I attached a patch that implement this. Please check if I implemented it correctly.
TagsNo 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 *********************** */
 
 
resume-suspend-download.patch (1,860 bytes)   

Activities

Christian Grothoff

2014-10-02 10:23

manager   ~0008593

Committed as SVN 34322, would be nice to have a testcase...

Issue History

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