- utilization can (easily, restart?) go out of control (very large), causing
content expiration job to go crazy and delete everything!
* FS: [CG]
- - EASY BUGS:
- + gnunet-download does not terminate when done (stop missing!)
- on some systems, keyword search does not find locally published content
(need testcase of command-line tools! - also good to cover getopt API!)
[could be related to datastore issue above!]
*/
enum GNUNET_FS_DownloadOptions options;
+ /**
+ * Flag set upon transitive completion (includes child downloads).
+ * This flag is only set to GNUNET_YES for directories where all
+ * child-downloads have also completed (and signalled completion).
+ */
+ int has_finished;
+
};
struct GNUNET_FS_Namespace
}
+/**
+ * Check if all child-downloads have completed and
+ * if so, signal completion (and possibly recurse to
+ * parent).
+ */
+static void
+check_completed (struct GNUNET_FS_DownloadContext *dc)
+{
+ struct GNUNET_FS_ProgressInfo pi;
+ struct GNUNET_FS_DownloadContext *pos;
+
+ pos = dc->child_head;
+ while (pos != NULL)
+ {
+ if ( (pos->emsg == NULL) &&
+ (pos->completed < pos->length) )
+ return; /* not done yet */
+ if ( (pos->child_head != NULL) &&
+ (pos->has_finished != GNUNET_YES) )
+ return; /* not transitively done yet */
+ pos = pos->next;
+ }
+ dc->has_finished = GNUNET_YES;
+ /* signal completion */
+ pi.status = GNUNET_FS_STATUS_DOWNLOAD_COMPLETED;
+ make_download_status (&pi, dc);
+ dc->client_info = dc->h->upcb (dc->h->upcb_cls,
+ &pi);
+ if (dc->parent != NULL)
+ check_completed (dc->parent);
+}
+
+
/**
* Iterator over entries in the pending requests in the 'active' map for the
* reply that we just got.
make_download_status (&pi, dc);
dc->client_info = dc->h->upcb (dc->h->upcb_cls,
&pi);
+ if (dc->parent != NULL)
+ check_completed (dc->parent);
}
GNUNET_assert (sm->depth == dc->treedepth);
}