diff options
| author | Kevin <115616336+lag@users.noreply.github.com> | 2026-03-06 19:23:32 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-06 19:23:32 -0600 |
| commit | 13960a93b2a7c114446c109de059db305db4555d (patch) | |
| tree | 1b681d91fd38f0d2da73024041e968160c22552b /Minecraft.Client/Windows64/Network/WinsockNetLayer.h | |
| parent | 16446265d555d21f564b5989611a05918728d643 (diff) | |
Max players from 8 -> 255 + small connection optimizations (#722)
* Multiplayer 8 to max byte increase.
Made-with: Cursor
* Server chunk optimizations for large player counts, server full notification fix, added to server.properties.
Diffstat (limited to 'Minecraft.Client/Windows64/Network/WinsockNetLayer.h')
| -rw-r--r-- | Minecraft.Client/Windows64/Network/WinsockNetLayer.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h index fd1280f7..f30240d3 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h @@ -12,7 +12,8 @@ #pragma comment(lib, "Ws2_32.lib") #define WIN64_NET_DEFAULT_PORT 25565 -#define WIN64_NET_MAX_CLIENTS 7 +#define WIN64_NET_MAX_CLIENTS 255 +#define WIN64_SMALLID_REJECT 0xFF #define WIN64_NET_RECV_BUFFER_SIZE 65536 #define WIN64_NET_MAX_PACKET_SIZE (4 * 1024 * 1024) #define WIN64_LAN_DISCOVERY_PORT 25566 @@ -89,6 +90,7 @@ public: static bool StartAdvertising(int gamePort, const wchar_t* hostName, unsigned int gameSettings, unsigned int texPackId, unsigned char subTexId, unsigned short netVer); static void StopAdvertising(); static void UpdateAdvertisePlayerCount(BYTE count); + static void UpdateAdvertiseMaxPlayers(BYTE maxPlayers); static void UpdateAdvertiseJoinable(bool joinable); static bool StartDiscovery(); @@ -116,7 +118,7 @@ private: static BYTE s_localSmallId; static BYTE s_hostSmallId; - static BYTE s_nextSmallId; + static unsigned int s_nextSmallId; static CRITICAL_SECTION s_sendLock; static CRITICAL_SECTION s_connectionsLock; @@ -141,6 +143,12 @@ private: static CRITICAL_SECTION s_freeSmallIdLock; static std::vector<BYTE> s_freeSmallIds; + // O(1) smallId -> socket lookup so we don't scan s_connections (which never shrinks) on every send + static SOCKET s_smallIdToSocket[256]; + static CRITICAL_SECTION s_smallIdToSocketLock; + +public: + static void ClearSocketForSmallId(BYTE smallId); }; extern bool g_Win64MultiplayerHost; |
