Skip to content

Commit fd57ff4

Browse files
committed
Core/Authserver: Reduce array size for socket initializers and auth packet handlers
1 parent 59e641d commit fd57ff4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/server/authserver/Server/AuthSession.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,18 @@ class AuthHandlerTable
162162
}
163163

164164
private:
165-
// perfect hash function for all valid values of eAuthCmd
165+
// perfect hash function for all valid client to server values of eAuthCmd
166166
inline static constexpr std::size_t GetOpcodeArrayIndex(eAuthCmd c)
167167
{
168-
return (c & 0x7) + ((c & 0x10) >> 2) + ((c & 0x20) >> 5);
168+
return (c & 0x7) + ((c & 0x10) >> 2) - ((c & 0x20) >> 5);
169169
}
170170

171171
constexpr void InitializeHandler(eAuthCmd cmd, AuthStatus status, std::size_t packetSize, bool (*handler)(AuthSession*))
172172
{
173173
_handlers[GetOpcodeArrayIndex(cmd)] = { .cmd = cmd, .status = status, .packetSize = packetSize, .handler = handler, };
174174
}
175175

176-
std::array<AuthHandler, 10> _handlers;
176+
std::array<AuthHandler, 8> _handlers;
177177
} inline constexpr Handlers;
178178

179179
void AccountInfo::LoadResult(Field* fields)
@@ -209,7 +209,7 @@ AuthSession::AuthSession(Trinity::Net::IoContextTcpSocket&& socket) : Socket(std
209209
void AuthSession::Start()
210210
{
211211
// build initializer chain
212-
std::array<std::shared_ptr<Trinity::Net::SocketConnectionInitializer>, 3> initializers =
212+
std::array<std::shared_ptr<Trinity::Net::SocketConnectionInitializer>, 2> initializers =
213213
{ {
214214
std::make_shared<Trinity::Net::IpBanCheckConnectionInitializer<AuthSession>>(this),
215215
std::make_shared<Trinity::Net::ReadConnectionInitializer<AuthSession>>(this),

0 commit comments

Comments
 (0)