Improved error handling of gta_data_service. (#412)

* Bug fix for #403

* Fixed Issue #403

* Minor fixes.

* Improved error handling of gta_data_service.

Fixed an issue where the game crashes when throwing invalid json format exception.

* Minor fixes.

* Minor fixes.

* Improved error handling of gta_data_service.

Also extended the timeout to 30s.

* Improved error handling of gta_data_service.

- Fixed an issue where http_request doesn't handle HEAD requests and socket.recv error correctly.

- Limited gta_data_service to have only 1 active http request.

* Minor fixes.

* Minor fixes.
This commit is contained in:
aa15032261
2022-08-13 23:17:59 +08:00
committed by GitHub
parent 8faa090ffd
commit 00a19d9290
4 changed files with 146 additions and 95 deletions

View File

@ -41,11 +41,14 @@ namespace big
const std::vector<weapon_item>& get_weapon_arr();
private:
void load_from_file(std::string file_path, std::string etag_path, std::string url, bool(gta_data_service::* load_func)(file), std::string data_name);
void load_from_file(
std::string file_path, std::string etag_path, std::string url,
bool(gta_data_service::* load_func)(std::filesystem::path), std::string data_name
);
bool load_vehicles(file file_to_load);
bool load_peds(file file_to_load);
bool load_weapons(file file_to_load);
bool load_vehicles(std::filesystem::path path);
bool load_peds(std::filesystem::path path);
bool load_weapons(std::filesystem::path path);
};
inline gta_data_service* g_gta_data_service{};