Furrent
|
#include <downloader.hpp>
Public Member Functions | |
Downloader (const TorrentFile &torrent, const Peer &peer) | |
Construct a new Downloader . No TCP socket is established at this time. More... | |
Result< Downloaded, DownloaderError > | try_download (const Piece &) |
Outcome< DownloaderError > | ensure_connected () |
Handles downloading of torrent pieces. Must be initialized with a TorrentFile
and a Peer
discovered from that same torrent. This type is intrinsically not copyable because it embeds an ASIO socket.
|
explicit |
Construct a new Downloader
. No TCP socket is established at this time.
Outcome< DownloaderError > fur::download::downloader::Downloader::ensure_connected | ( | ) |
Ensures that the socket
is present and in good health (not dropped, timed out and such). Should always call this method first, before accessing the socket.
Result< Downloaded, DownloaderError > fur::download::downloader::Downloader::try_download | ( | const Piece & | task | ) |
Attempt downloading a piece using this Downloader
. The function tries it best not to throw any exception (unless something truly exceptional happens). You can assume that any ordinary error will result in a std::nullopt
being returned. Errors such as: