Prevent head of line blocking and track server resource download progress

This commit is contained in:
Yousef Khadadeh 2025-10-10 10:34:12 +03:00
parent 344ef4093a
commit 2aab3e9e60
14 changed files with 179 additions and 83 deletions

View file

@ -7,6 +7,7 @@
#include <cereal/types/string.hpp>
#include <cereal/types/unordered_map.hpp>
#include <queue>
#include <Helpers/Networking/NetLibrary.hpp>
class World;
@ -44,12 +45,12 @@ class ResourceManager {
std::optional<ResourceData> get_resource(const ServerClientID& id) const;
ClientPortionID get_max_id(ServerPortionID serverID) const;
const std::unordered_map<ServerClientID, ResourceData>& resource_list();
ServerClientID get_resource_being_retrieved();
float get_resource_retrieval_progress();
float get_resource_retrieval_progress(const ServerClientID& id);
World& world;
private:
ServerClientID resourceBeingRetrieved = {0, 0};
std::unordered_map<ServerClientID, NetLibrary::DownloadProgress> serverDownloadProgress;
ServerClientID resourceBeingRetrievedClient = {0, 0};
std::unordered_map<ServerClientID, ResourceData> resources;
std::unordered_map<ServerClientID, std::shared_ptr<ResourceDisplay>> displays;