rippled
|
Provides an asynchronous HTTP[S] file downloader. More...
Public Types | |
using | error_code = boost::system::error_code |
Public Member Functions | |
bool | download (std::string const &host, std::string const &port, std::string const &target, int version, boost::filesystem::path const &dstPath, std::function< void(boost::filesystem::path)> complete, bool ssl=true) |
void | stop () |
virtual | ~HTTPDownloader ()=default |
bool | sessionIsActive () const |
bool | isStopping () const |
T | shared_from_this (T... args) |
T | weak_from_this (T... args) |
Protected Types | |
using | parser = boost::beast::http::basic_parser< false > |
Protected Member Functions | |
HTTPDownloader (boost::asio::io_service &io_service, Config const &config, beast::Journal j) | |
void | fail (boost::filesystem::path dstPath, boost::system::error_code const &ec, std::string const &errMsg, std::shared_ptr< parser > parser) |
Protected Attributes | |
const beast::Journal | j_ |
Private Member Functions | |
void | do_session (std::string host, std::string port, std::string target, int version, boost::filesystem::path dstPath, std::function< void(boost::filesystem::path)> complete, bool ssl, boost::asio::yield_context yield) |
virtual std::shared_ptr< parser > | getParser (boost::filesystem::path dstPath, std::function< void(boost::filesystem::path)> complete, boost::system::error_code &ec)=0 |
virtual bool | checkPath (boost::filesystem::path const &dstPath)=0 |
virtual void | closeBody (std::shared_ptr< parser > p)=0 |
virtual uint64_t | size (std::shared_ptr< parser > p)=0 |
Private Attributes | |
Config const & | config_ |
boost::asio::io_service::strand | strand_ |
std::unique_ptr< HTTPStream > | stream_ |
boost::beast::flat_buffer | read_buf_ |
std::atomic< bool > | stop_ |
std::mutex | m_ |
bool | sessionActive_ |
std::condition_variable | c_ |
Provides an asynchronous HTTP[S] file downloader.
Definition at line 44 of file HTTPDownloader.h.
using ripple::HTTPDownloader::error_code = boost::system::error_code |
Definition at line 47 of file HTTPDownloader.h.
|
protected |
Definition at line 78 of file HTTPDownloader.h.
|
virtualdefault |
|
protected |
Definition at line 25 of file HTTPDownloader.cpp.
bool ripple::HTTPDownloader::download | ( | std::string const & | host, |
std::string const & | port, | ||
std::string const & | target, | ||
int | version, | ||
boost::filesystem::path const & | dstPath, | ||
std::function< void(boost::filesystem::path)> | complete, | ||
bool | ssl = true |
||
) |
Definition at line 38 of file HTTPDownloader.cpp.
void ripple::HTTPDownloader::stop | ( | ) |
Definition at line 284 of file HTTPDownloader.cpp.
bool ripple::HTTPDownloader::sessionIsActive | ( | ) | const |
Definition at line 297 of file HTTPDownloader.cpp.
bool ripple::HTTPDownloader::isStopping | ( | ) | const |
Definition at line 304 of file HTTPDownloader.cpp.
|
protected |
Definition at line 311 of file HTTPDownloader.cpp.
|
private |
Definition at line 87 of file HTTPDownloader.cpp.
|
privatepure virtual |
Implemented in ripple::DatabaseDownloader.
|
privatepure virtual |
Implemented in ripple::DatabaseDownloader.
|
privatepure virtual |
Implemented in ripple::DatabaseDownloader.
|
privatepure virtual |
Implemented in ripple::DatabaseDownloader.
|
protected |
Definition at line 80 of file HTTPDownloader.h.
|
private |
Definition at line 90 of file HTTPDownloader.h.
|
private |
Definition at line 91 of file HTTPDownloader.h.
|
private |
Definition at line 92 of file HTTPDownloader.h.
|
private |
Definition at line 93 of file HTTPDownloader.h.
|
private |
Definition at line 94 of file HTTPDownloader.h.
|
mutableprivate |
Definition at line 97 of file HTTPDownloader.h.
|
private |
Definition at line 98 of file HTTPDownloader.h.
|
private |
Definition at line 99 of file HTTPDownloader.h.