aboutsummaryrefslogtreecommitdiff
path: root/src/common/download.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-02-26 12:00:45 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-03-05 16:58:48 +0000
commit63f0e074ebcce0dff6f78072ed751aaa1d9b601f (patch)
tree278a1e9c3ac7e13546a15e9144d2b7eeb76bcd46 /src/common/download.h
parenthttp_client: allow cancelling a download (diff)
downloadmonero-63f0e074ebcce0dff6f78072ed751aaa1d9b601f.tar.xz
download: async API
Diffstat (limited to '')
-rw-r--r--src/common/download.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/common/download.h b/src/common/download.h
index ab7644689..917cb2278 100644
--- a/src/common/download.h
+++ b/src/common/download.h
@@ -32,5 +32,13 @@
namespace tools
{
- bool download(const std::string &path, const std::string &url);
+ struct download_thread_control;
+ typedef std::shared_ptr<download_thread_control> download_async_handle;
+
+ bool download(const std::string &path, const std::string &url, std::function<bool(const std::string&, const std::string&, size_t, ssize_t)> progress = NULL);
+ download_async_handle download_async(const std::string &path, const std::string &url, std::function<void(const std::string&, const std::string&, bool)> result, std::function<bool(const std::string&, const std::string&, size_t, ssize_t)> progress = NULL);
+ bool download_error(const download_async_handle &h);
+ bool download_finished(const download_async_handle &h);
+ bool download_wait(const download_async_handle &h);
+ bool download_cancel(const download_async_handle &h);
}