mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 13:37:22 +00:00
Remove hardcoded port number in AuthPackets
Removes the hard coded port numbers in AuthPackets
This commit is contained in:
parent
2f48981801
commit
2570c74b71
@ -29,16 +29,16 @@ void AuthPackets::HandleHandshake(dServer* server, Packet* packet) {
|
|||||||
inStream.Read(clientVersion);
|
inStream.Read(clientVersion);
|
||||||
|
|
||||||
server->GetLogger()->Log("AuthPackets", "Received client version: %i", clientVersion);
|
server->GetLogger()->Log("AuthPackets", "Received client version: %i", clientVersion);
|
||||||
SendHandshake(server, packet->systemAddress, server->GetIP(), server->GetPort());
|
SendHandshake(server, packet->systemAddress, server->GetIP(), server->GetPort(), server->GetServerType());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthPackets::SendHandshake(dServer* server, const SystemAddress& sysAddr, const std::string& nextServerIP, uint16_t nextServerPort) {
|
void AuthPackets::SendHandshake(dServer* server, const SystemAddress& sysAddr, const std::string& nextServerIP, uint16_t nextServerPort, const ServerType serverType) {
|
||||||
RakNet::BitStream bitStream;
|
RakNet::BitStream bitStream;
|
||||||
PacketUtils::WriteHeader(bitStream, SERVER, MSG_SERVER_VERSION_CONFIRM);
|
PacketUtils::WriteHeader(bitStream, SERVER, MSG_SERVER_VERSION_CONFIRM);
|
||||||
bitStream.Write<unsigned int>(NET_VERSION);
|
bitStream.Write<unsigned int>(NET_VERSION);
|
||||||
bitStream.Write(uint32_t(0x93));
|
bitStream.Write(uint32_t(0x93));
|
||||||
|
|
||||||
if (nextServerPort == 1001) bitStream.Write(uint32_t(1)); //Conn: auth
|
if (serverType == ServerType::Auth) bitStream.Write(uint32_t(1)); //Conn: auth
|
||||||
else bitStream.Write(uint32_t(4)); //Conn: world
|
else bitStream.Write(uint32_t(4)); //Conn: world
|
||||||
|
|
||||||
bitStream.Write(uint32_t(0)); //Server process ID
|
bitStream.Write(uint32_t(0)); //Server process ID
|
||||||
|
@ -5,11 +5,12 @@
|
|||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
#include "dNetCommon.h"
|
#include "dNetCommon.h"
|
||||||
|
|
||||||
|
enum class ServerType : uint32_t;
|
||||||
class dServer;
|
class dServer;
|
||||||
|
|
||||||
namespace AuthPackets {
|
namespace AuthPackets {
|
||||||
void HandleHandshake(dServer* server, Packet* packet);
|
void HandleHandshake(dServer* server, Packet* packet);
|
||||||
void SendHandshake(dServer* server, const SystemAddress& sysAddr, const std::string& nextServerIP, uint16_t nextServerPort);
|
void SendHandshake(dServer* server, const SystemAddress& sysAddr, const std::string& nextServerIP, uint16_t nextServerPort, const ServerType serverType);
|
||||||
|
|
||||||
void HandleLoginRequest(dServer* server, Packet* packet);
|
void HandleLoginRequest(dServer* server, Packet* packet);
|
||||||
void SendLoginResponse(dServer* server, const SystemAddress& sysAddr, eLoginResponse responseCode, const std::string& errorMsg, const std::string& wServerIP, uint16_t wServerPort, std::string username);
|
void SendLoginResponse(dServer* server, const SystemAddress& sysAddr, eLoginResponse responseCode, const std::string& errorMsg, const std::string& wServerIP, uint16_t wServerPort, std::string username);
|
||||||
|
Loading…
Reference in New Issue
Block a user