add debug print and dont try new format if the packet looks invalid

This commit is contained in:
Lion Kortlepel 2024-10-06 15:26:02 +02:00
parent 885061f73d
commit dd3622170e
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -377,7 +377,7 @@ 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());
warn("Failed to receive new mod list format! This server may be outdated, but everything will still work as expected."); warn("Failed to receive new mod list format! This server may be outdated, but everything should still work as expected.");
return {}; return {};
} }
return modInfos; return modInfos;
@ -511,12 +511,16 @@ 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);
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); 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())
return; return;