2 Commits

Author SHA1 Message Date
Lion Kortlepel
dd3622170e add debug print and dont try new format if the packet looks invalid 2024-10-06 15:26:02 +02:00
Lion Kortlepel
885061f73d add more info to new mod list receive error 2024-10-06 15:22:45 +02:00

View File

@@ -377,8 +377,8 @@ struct ModInfo {
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
debug(std::string("Failed to receive mod list: ") + e.what()); debug(std::string("Failed to receive mod list: ") + e.what());
error("Failed to receive mod list!"); warn("Failed to receive new mod list format! This server may be outdated, but everything should still work as expected.");
// TODO: Cry and die return {};
} }
return modInfos; return modInfos;
} }
@@ -511,11 +511,15 @@ void NewSyncResources(SOCKET Sock, const std::string& Mods, const std::vector<Mo
void SyncResources(SOCKET Sock) { void SyncResources(SOCKET Sock) {
std::string Ret = Auth(Sock); std::string Ret = Auth(Sock);
auto ModInfos = ModInfo::ParseModInfosFromPacket(Ret); if (Ret.starts_with("R")) {
debug("This server is likely outdated, not trying to parse new mod info format");
} else {
auto ModInfos = ModInfo::ParseModInfosFromPacket(Ret);
if (!ModInfos.empty()) { if (!ModInfos.empty()) {
NewSyncResources(Sock, Ret, ModInfos); NewSyncResources(Sock, Ret, ModInfos);
return; return;
}
} }
if (Ret.empty()) if (Ret.empty())