Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(server): slots <<= 1
two thousand and forty eight sluts
  • Loading branch information
blattersturm committed Jan 1, 2022
1 parent f78dc31 commit a03eb34
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions code/components/citizen-server-impl/include/Client.h
Expand Up @@ -23,7 +23,7 @@

#include <shared_mutex>

#define MAX_CLIENTS (1024 + 1) // don't change this past 256 ever, also needs to be synced with client code
constexpr auto MAX_CLIENTS = (2048 + 1);

namespace {
using namespace std::literals::chrono_literals;
Expand Down Expand Up @@ -406,7 +406,7 @@ namespace fx
void (*m_clientNetworkMetricsRecvCallback)(Client *thisptr, uint32_t packetId, net::Buffer& packet);
};

extern SERVER_IMPL_EXPORT object_pool<Client, 512 * 1024> clientPool;
extern SERVER_IMPL_EXPORT object_pool<Client, 512 * MAX_CLIENTS> clientPool;

using ClientSharedPtr = shared_reference<Client, &clientPool>;
using ClientWeakPtr = weak_reference<ClientSharedPtr>;
Expand Down
2 changes: 1 addition & 1 deletion code/components/citizen-server-impl/src/Client.cpp
Expand Up @@ -111,5 +111,5 @@ namespace fx
}
}

DLL_EXPORT object_pool<Client, 512 * 1024> clientPool;
DLL_EXPORT object_pool<Client, 512 * MAX_CLIENTS> clientPool;
}
Expand Up @@ -499,7 +499,7 @@ namespace fx
{
// create an ENet host
ENetAddress addr = GetENetAddress(address);
ENetHost* host = enet_host_create(&addr, 1024, 2, 0, 0);
ENetHost* host = enet_host_create(&addr, std::min(MAX_CLIENTS + 32, int(ENET_PROTOCOL_MAXIMUM_PEER_ID)), 2, 0, 0);

// ensure the host exists
if (!host)
Expand Down
4 changes: 2 additions & 2 deletions code/components/net/src/NetLibrary.cpp
Expand Up @@ -1275,7 +1275,7 @@ concurrency::task<void> NetLibrary::ConnectToServer(const std::string& rootUrl)
onesyncType = "onesync_medium";
}
}
else if (maxClients <= 1024)
else if (maxClients <= 2048)
{
onesyncType = "onesync_big";
}
Expand Down Expand Up @@ -1351,7 +1351,7 @@ concurrency::task<void> NetLibrary::ConnectToServer(const std::string& rootUrl)

if (policies.find("onesync_big") != policies.end())
{
maxSlots = 1024;
maxSlots = 2048;
}

OnConnectionError(fmt::sprintf("This server uses more slots than allowed by policy. The allowed slot count is %d, but the server has a maximum slot count of %d.",
Expand Down

0 comments on commit a03eb34

Please sign in to comment.