mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-05 23:08:31 +00:00
Consolidate serviceID enums into one enum (#1855)
* merge ServerType and ServiceID enums * rename eConnectionType to ServiceType in preparation for enum unification * unify ServiceID and ServiceType enums * shrink ServiceType to an 8-bit integer * fix linux compilation error and update gamemsg test * return to uint16_t * Update dNet/AuthPackets.cpp Use cast instead of padding Co-authored-by: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> * Add default case to MasterServer.cpp * move ref back to type * Another formatting fix * Fix comment to be more accurate --------- Co-authored-by: jadebenn <9892985+jadebenn@users.noreply.github.com> Co-authored-by: David Markowitz <39972741+EmosewaMC@users.noreply.github.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "RakNetworkFactory.h"
|
||||
#include "MessageIdentifiers.h"
|
||||
#include "eConnectionType.h"
|
||||
#include "ServiceType.h"
|
||||
#include "MessageType/Server.h"
|
||||
#include "MessageType/Master.h"
|
||||
|
||||
@@ -50,7 +50,7 @@ dServer::dServer(
|
||||
Logger* logger,
|
||||
const std::string masterIP,
|
||||
int masterPort,
|
||||
ServerType serverType,
|
||||
ServiceType serverType,
|
||||
dConfig* config,
|
||||
Game::signal_t* lastSignal,
|
||||
const std::string& masterPassword,
|
||||
@@ -87,7 +87,7 @@ dServer::dServer(
|
||||
} else {
|
||||
LOG("FAILED TO START SERVER ON IP/PORT: %s:%i", ip.c_str(), port);
|
||||
#ifdef DARKFLAME_PLATFORM_LINUX
|
||||
if (mServerType == ServerType::Auth) {
|
||||
if (mServerType == ServiceType::AUTH) {
|
||||
const auto cwd = BinaryPathFinder::GetBinaryDir();
|
||||
LOG("Try running the following command before launching again:\n sudo setcap 'cap_net_bind_service=+ep' \"%s/AuthServer\"", cwd.string().c_str());
|
||||
}
|
||||
@@ -98,7 +98,7 @@ dServer::dServer(
|
||||
mLogger->SetLogToConsole(prevLogSetting);
|
||||
|
||||
//Connect to master if we are not master:
|
||||
if (serverType != ServerType::Master) {
|
||||
if (serverType != ServiceType::MASTER) {
|
||||
SetupForMasterConnection();
|
||||
if (!ConnectToMaster()) {
|
||||
LOG("Failed ConnectToMaster!");
|
||||
@@ -106,7 +106,7 @@ dServer::dServer(
|
||||
}
|
||||
|
||||
//Set up Replica if we're a world server:
|
||||
if (serverType == ServerType::World) {
|
||||
if (serverType == ServiceType::WORLD) {
|
||||
mNetIDManager = new NetworkIDManager();
|
||||
mNetIDManager->SetIsNetworkIDAuthority(true);
|
||||
|
||||
@@ -151,7 +151,7 @@ Packet* dServer::ReceiveFromMaster() {
|
||||
break;
|
||||
}
|
||||
case ID_USER_PACKET_ENUM: {
|
||||
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::MASTER) {
|
||||
if (static_cast<ServiceType>(packet->data[1]) == ServiceType::MASTER) {
|
||||
switch (static_cast<MessageType::Master>(packet->data[3])) {
|
||||
case MessageType::Master::REQUEST_ZONE_TRANSFER_RESPONSE: {
|
||||
ZoneInstanceManager::Instance()->HandleRequestZoneTransferResponse(packet);
|
||||
@@ -199,7 +199,7 @@ void dServer::SendToMaster(RakNet::BitStream& bitStream) {
|
||||
|
||||
void dServer::Disconnect(const SystemAddress& sysAddr, eServerDisconnectIdentifiers disconNotifyID) {
|
||||
RakNet::BitStream bitStream;
|
||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::SERVER, MessageType::Server::DISCONNECT_NOTIFY);
|
||||
BitStreamUtils::WriteHeader(bitStream, ServiceType::COMMON, MessageType::Server::DISCONNECT_NOTIFY);
|
||||
bitStream.Write(disconNotifyID);
|
||||
mPeer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE_ORDERED, 0, sysAddr, false);
|
||||
|
||||
@@ -257,7 +257,7 @@ void dServer::Shutdown() {
|
||||
mReplicaManager = nullptr;
|
||||
}
|
||||
|
||||
if (mServerType != ServerType::Master && mMasterPeer) {
|
||||
if (mServerType != ServiceType::MASTER && mMasterPeer) {
|
||||
mMasterPeer->Shutdown(1000);
|
||||
RakNetworkFactory::DestroyRakPeerInterface(mMasterPeer);
|
||||
}
|
||||
|
Reference in New Issue
Block a user