Skip to content

Commit

Permalink
Fix gamemode name causing splitting on server browser
Browse files Browse the repository at this point in the history
Bump revision number
  • Loading branch information
danielga committed May 28, 2023
1 parent ab9eb8f commit 62f381d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include <string>

namespace global {
static constexpr std::string_view Version = "serversecure 1.5.41";
static constexpr std::string_view Version = "serversecure 1.5.42";
// version num follows LuaJIT style, xxyyzz
static constexpr uint32_t VersionNum = 10541;
static constexpr uint32_t VersionNum = 10542;

static IServer *server = nullptr;

Expand Down
19 changes: 15 additions & 4 deletions source/netfilter/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,15 @@ class Core {
dynamic_cast<CFileSystem_Stdio *>(filesystem)->Gamemodes()->Active();

if (!gamemode.name.empty()) {
reply_info.tags.gm = gamemode.name;
// Check if gamemode name ends with "_modded"
static const std::string suffix = "_modded";
auto gm_name = gamemode.name;
if (gm_name.size() > suffix.size() &&
std::equal(gm_name.rbegin(), gm_name.rend(), suffix.rbegin())) {
gm_name = gm_name.substr(0, suffix.size());
}

reply_info.tags.gm = gm_name;
} else {
reply_info.tags.gm.clear();
}
Expand Down Expand Up @@ -671,7 +679,8 @@ class Core {
return PacketType::Good;

case 'q': // connection handshake init
DevMsg(2, "[ServerSecure] Good OOB! len: %d, channel: 0x%X, type: %c from "
DevMsg(2,
"[ServerSecure] Good OOB! len: %d, channel: 0x%X, type: %c from "
"%s\n",
len, channel, type, IPToString(from.sin_addr));
return PacketType::Good;
Expand Down Expand Up @@ -743,7 +752,8 @@ class Core {
return PacketType::Invalid;
}

DevMsg(2, "[ServerSecure] Good OOB! len: %d, channel: 0x%X, type: %c from "
DevMsg(2,
"[ServerSecure] Good OOB! len: %d, channel: 0x%X, type: %c from "
"%s\n",
len, channel, type, IPToString(from.sin_addr));
return PacketType::Good;
Expand Down Expand Up @@ -829,7 +839,8 @@ class Core {
}

const ssize_t len = trampoline(s, buf, buflen, flags, from, fromlen);
DevMsg(3, "[ServerSecure] Called recvfrom on socket %" PRIiSOCKET
DevMsg(3,
"[ServerSecure] Called recvfrom on socket %" PRIiSOCKET
" and received %" PRIiSSIZE " bytes\n",
s, len);
if (len == -1) {
Expand Down

0 comments on commit 62f381d

Please sign in to comment.