aboutsummaryrefslogtreecommitdiff
path: root/src/client/clientmedia.h
diff options
context:
space:
mode:
authorElias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com>2020-11-04 16:44:42 +0100
committerGitHub <noreply@github.com>2020-11-04 16:44:42 +0100
commit5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (patch)
treec980d614fec4a5495798be3e79e033229062c3cd /src/client/clientmedia.h
parent28f6a79706b088c37268a59d90878220dc4ef9c7 (diff)
parent3af10766fd2b58b068e970266724d7eb10e9316b (diff)
downloaddragonfireclient-5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc.tar.xz
Merge branch 'master' into master
Diffstat (limited to 'src/client/clientmedia.h')
-rw-r--r--src/client/clientmedia.h43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/client/clientmedia.h b/src/client/clientmedia.h
index 5a918535b..6a52c551d 100644
--- a/src/client/clientmedia.h
+++ b/src/client/clientmedia.h
@@ -35,8 +35,7 @@ struct HTTPFetchResult;
// Store file into media cache (unless it exists already)
// Validating the hash is responsibility of the caller
-bool clientMediaUpdateCache(const std::string &raw_hash,
- const std::string &filedata);
+bool clientMediaUpdateCache(const std::string &raw_hash, const std::string &filedata);
class ClientMediaDownloader
{
@@ -44,22 +43,21 @@ public:
ClientMediaDownloader();
~ClientMediaDownloader();
- float getProgress() const {
+ float getProgress() const
+ {
if (m_uncached_count >= 1)
- return 1.0f * m_uncached_received_count /
- m_uncached_count;
+ return 1.0f * m_uncached_received_count / m_uncached_count;
return 0.0f;
}
- bool isStarted() const {
- return m_initial_step_done;
- }
+ bool isStarted() const { return m_initial_step_done; }
// If this returns true, the downloader is done and can be deleted
- bool isDone() const {
+ bool isDone() const
+ {
return m_initial_step_done &&
- m_uncached_received_count == m_uncached_count;
+ m_uncached_received_count == m_uncached_count;
}
// Add a file to the list of required file (but don't fetch it yet)
@@ -82,44 +80,42 @@ public:
// Must be called for each file received through TOCLIENT_MEDIA
void conventionalTransferDone(
- const std::string &name,
- const std::string &data,
- Client *client);
+ const std::string &name, const std::string &data, Client *client);
private:
- struct FileStatus {
+ struct FileStatus
+ {
bool received;
std::string sha1;
s32 current_remote;
std::vector<s32> available_remotes;
};
- struct RemoteServerStatus {
+ struct RemoteServerStatus
+ {
std::string baseurl;
s32 active_count;
};
void initialStep(Client *client);
void remoteHashSetReceived(const HTTPFetchResult &fetch_result);
- void remoteMediaReceived(const HTTPFetchResult &fetch_result,
- Client *client);
+ void remoteMediaReceived(const HTTPFetchResult &fetch_result, Client *client);
s32 selectRemoteServer(FileStatus *filestatus);
void startRemoteMediaTransfers();
void startConventionalTransfers(Client *client);
bool checkAndLoad(const std::string &name, const std::string &sha1,
- const std::string &data, bool is_from_cache,
- Client *client);
+ const std::string &data, bool is_from_cache, Client *client);
std::string serializeRequiredHashSet();
- static void deSerializeHashSet(const std::string &data,
- std::set<std::string> &result);
+ static void deSerializeHashSet(
+ const std::string &data, std::set<std::string> &result);
// Maps filename to file status
- std::map<std::string, FileStatus*> m_files;
+ std::map<std::string, FileStatus *> m_files;
// Array of remote media servers
- std::vector<RemoteServerStatus*> m_remotes;
+ std::vector<RemoteServerStatus *> m_remotes;
// Filesystem-based media cache
FileCache m_media_cache;
@@ -148,5 +144,4 @@ private:
// don't need to be looked at again
// (use m_files.upper_bound(m_name_bound) to get an iterator)
std::string m_name_bound = "";
-
};