+ task->async_cb(task->result, task->async_data);
+}
+
+static void load_url_async_start_pending(struct load_task *task, int flags)
+{
+ pb_log("Starting pending job for %s\n", task->url->full);
+
+ switch (task->url->scheme) {
+ case pb_url_ftp:
+ case pb_url_http:
+ load_wget(task, flags);
+ break;
+ case pb_url_https:
+ flags |= wget_no_check_certificate;
+ load_wget(task, flags);
+ break;
+ case pb_url_nfs:
+ load_nfs(task);
+ break;
+ case pb_url_sftp:
+ load_sftp(task);
+ break;
+ case pb_url_tftp:
+ load_tftp(task);
+ break;
+ default:
+ /* Shouldn't be a need via this path but.. */
+ load_local(task);
+ break;
+ }
+
+ if (task->result->status == LOAD_ERROR) {
+ pb_log("Pending job failed for %s\n", task->url->full);
+ load_url_result_cleanup_local(task->result);
+ talloc_free(task->result);
+ talloc_free(task);
+ }
+}
+
+void pending_network_jobs_start(void)
+{
+ struct network_job *job, *tmp;
+
+ if (!pending_network_jobs.head.next)
+ return;
+
+ list_for_each_entry_safe(&pending_network_jobs, job, tmp, list) {
+ load_url_async_start_pending(job->task, job->flags);
+ list_remove(&job->list);
+ }
+}
+
+void pending_network_jobs_cancel(void)
+{
+ struct network_job *job, *tmp;
+
+ if (!pending_network_jobs.head.next)
+ return;
+
+ list_for_each_entry_safe(&pending_network_jobs, job, tmp, list)
+ talloc_free(job);
+ list_init(&pending_network_jobs);
+}
+
+static void pending_network_jobs_add(struct load_task *task, int flags)
+{
+ struct network_job *job;
+
+ if (!pending_network_jobs.head.next)
+ list_init(&pending_network_jobs);