From 5198b2614ee9bee0efcc1ea100443b8cfa9fa8ad Mon Sep 17 00:00:00 2001 From: IntelligentQuantum Date: Fri, 27 Dec 2019 02:31:57 +0330 Subject: [PATCH] chore(Core/Soap): Renamed TCSoap to ACSoap (#2509) --- .../{TCSoap/TCSoap.cpp => ACSoap/ACSoap.cpp} | 26 ++++++------- .../{TCSoap/TCSoap.h => ACSoap/ACSoap.h} | 17 +++------ src/server/worldserver/Master.cpp | 38 +++++++++---------- 3 files changed, 38 insertions(+), 43 deletions(-) rename src/server/worldserver/{TCSoap/TCSoap.cpp => ACSoap/ACSoap.cpp} (86%) rename src/server/worldserver/{TCSoap/TCSoap.h => ACSoap/ACSoap.h} (82%) diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/ACSoap/ACSoap.cpp similarity index 86% rename from src/server/worldserver/TCSoap/TCSoap.cpp rename to src/server/worldserver/ACSoap/ACSoap.cpp index e109c84b4..6d2f4389c 100644 --- a/src/server/worldserver/TCSoap/TCSoap.cpp +++ b/src/server/worldserver/ACSoap/ACSoap.cpp @@ -4,13 +4,13 @@ * Copyright (C) 2005-2009 MaNGOS */ -#include "TCSoap.h" +#include "ACSoap.h" #include "soapH.h" #include "soapStub.h" #include "Log.h" #include "World.h" -void TCSoapRunnable::run() +void ACSoapRunnable::run() { struct soap soap; soap_init(&soap); @@ -23,11 +23,11 @@ void TCSoapRunnable::run() soap.send_timeout = 5; if (!soap_valid_socket(soap_bind(&soap, _host.c_str(), _port, 100))) { - sLog->outError("TCSoap: couldn't bind to %s:%d", _host.c_str(), _port); + sLog->outError("ACSoap: couldn't bind to %s:%d", _host.c_str(), _port); exit(-1); } - sLog->outString("TCSoap: bound to http://%s:%d", _host.c_str(), _port); + sLog->outString("ACSoap: bound to http://%s:%d", _host.c_str(), _port); while (!World::IsStopped()) { @@ -35,7 +35,7 @@ void TCSoapRunnable::run() continue; // ran into an accept timeout #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF); + sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF); #endif struct soap* thread_soap = soap_copy(&soap);// make a safe copy @@ -47,7 +47,7 @@ void TCSoapRunnable::run() soap_done(&soap); } -void TCSoapRunnable::process_message(ACE_Message_Block* mb) +void ACSoapRunnable::process_message(ACE_Message_Block* mb) { ACE_TRACE (ACE_TEXT ("SOAPWorkingThread::process_message")); @@ -72,7 +72,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) if (!soap->userid || !soap->passwd) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: Client didn't provide login information"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: Client didn't provide login information"); #endif return 401; } @@ -81,7 +81,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) if (!accountId) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: Client used invalid username '%s'", soap->userid); + sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: Client used invalid username '%s'", soap->userid); #endif return 401; } @@ -89,7 +89,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) if (!AccountMgr::CheckPassword(accountId, soap->passwd)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: invalid password for account '%s'", soap->userid); + sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: invalid password for account '%s'", soap->userid); #endif return 401; } @@ -97,7 +97,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) if (AccountMgr::GetSecurity(accountId) < SEC_ADMINISTRATOR) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: %s's gmlevel is too low", soap->userid); + sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: %s's gmlevel is too low", soap->userid); #endif return 403; } @@ -106,7 +106,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) return soap_sender_fault(soap, "Command can not be empty", "The supplied command was an empty string"); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: got command '%s'", command); + sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: got command '%s'", command); #endif SOAPCommand connection; @@ -122,7 +122,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) int acc = connection.pendingCommands.acquire(); if (acc) { - sLog->outError("TCSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno); + sLog->outError("ACSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno); } // alright, command finished @@ -155,6 +155,6 @@ struct Namespace namespaces[] = { "SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", NULL, NULL }, // must be second { "xsi", "http://www.w3.org/1999/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL }, { "xsd", "http://www.w3.org/1999/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL }, - { "ns1", "urn:TC", NULL, NULL }, // "ns1" namespace prefix + { "ns1", "urn:AC", NULL, NULL }, // "ns1" namespace prefix { NULL, NULL, NULL, NULL } }; diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/ACSoap/ACSoap.h similarity index 82% rename from src/server/worldserver/TCSoap/TCSoap.h rename to src/server/worldserver/ACSoap/ACSoap.h index 932797c6d..15ae272d9 100644 --- a/src/server/worldserver/TCSoap/TCSoap.h +++ b/src/server/worldserver/ACSoap/ACSoap.h @@ -4,8 +4,8 @@ * Copyright (C) 2005-2009 MaNGOS */ -#ifndef _TCSOAP_H -#define _TCSOAP_H +#ifndef _ACSOAP_H +#define _ACSOAP_H #include "Define.h" #include "AccountMgr.h" @@ -14,10 +14,10 @@ #include #include -class TCSoapRunnable : public acore::Runnable +class ACSoapRunnable : public acore::Runnable { public: - TCSoapRunnable() : _port(0) { } + ACSoapRunnable() : _port(0) { } void run(); @@ -37,14 +37,9 @@ class TCSoapRunnable : public acore::Runnable class SOAPCommand { public: - SOAPCommand(): - pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false) - { - } + SOAPCommand(): pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false) {} - ~SOAPCommand() - { - } + ~SOAPCommand() { } void appendToPrintBuffer(const char* msg) { diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index d4250931e..509558d34 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -23,7 +23,7 @@ #include "Log.h" #include "Master.h" #include "RARunnable.h" -#include "TCSoap.h" +#include "ACSoap.h" #include "Timer.h" #include "Util.h" #include "RealmList.h" @@ -121,16 +121,16 @@ int Master::Run() sLog->outString("%s (worldserver-daemon)", GitRevision::GetFullVersion()); sLog->outString(" to stop.\n"); - sLog->outString(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗"); - sLog->outString(" ██╔══██╗╚══███╔╝██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝██║ ██║"); - sLog->outString(" ███████║ ███╔╝ █████╗ ██████╔╝██║ ██║ ██║ ███████║"); - sLog->outString(" ██╔══██║ ███╔╝ ██╔══╝ ██╔══██╗██║ ██║ ██║ ██╔══██║"); - sLog->outString(" ██║ ██║███████╗███████╗██║ ██║╚██████╔╝ ██║ ██║ ██║"); - sLog->outString(" ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝"); + sLog->outString(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗"); + sLog->outString(" ██╔══██╗╚══███╔╝██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝██║ ██║"); + sLog->outString(" ███████║ ███╔╝ █████╗ ██████╔╝██║ ██║ ██║ ███████║"); + sLog->outString(" ██╔══██║ ███╔╝ ██╔══╝ ██╔══██╗██║ ██║ ██║ ██╔══██║"); + sLog->outString(" ██║ ██║███████╗███████╗██║ ██║╚██████╔╝ ██║ ██║ ██║"); + sLog->outString(" ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝"); sLog->outString(" ██████╗ ██████╗ ██████╗ ███████╗"); sLog->outString(" ██╔════╝██╔═══██╗██╔══██╗██╔═══╝"); - sLog->outString(" ██║ ██║ ██║██████╔╝█████╗"); - sLog->outString(" ██║ ██║ ██║██╔══██╗██╔══╝"); + sLog->outString(" ██║ ██║ ██║██████╔╝█████╗"); + sLog->outString(" ██║ ██║ ██║██╔══██╗██╔══╝"); sLog->outString(" ╚██████╗╚██████╔╝██║ ██║███████╗"); sLog->outString(" ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝\n"); @@ -202,25 +202,25 @@ int Master::Run() auctionLising_thread.setPriority(acore::Priority_High); #if defined(_WIN32) || defined(__linux__) - + ///- Handle affinity for multiple processors and process priority uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false); #ifdef _WIN32 // Windows - + HANDLE hProcess = GetCurrentProcess(); - + if (affinity > 0) { ULONG_PTR appAff; ULONG_PTR sysAff; - + if (GetProcessAffinityMask(hProcess, &appAff, &sysAff)) { ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors - + if (!currentAffinity) sLog->outError("Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff); else if (SetProcessAffinityMask(hProcess, currentAffinity)) @@ -229,7 +229,7 @@ int Master::Run() sLog->outError("Can't set used processors (hex): %x", currentAffinity); } } - + if (highPriority) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) @@ -237,9 +237,9 @@ int Master::Run() else sLog->outError("Can't set worldserver process priority class."); } - + #else // Linux - + if (affinity > 0) { cpu_set_t mask; @@ -266,7 +266,7 @@ int Master::Run() else sLog->outString("worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); } - + #endif #endif @@ -274,7 +274,7 @@ int Master::Run() acore::Thread* soapThread = NULL; if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false)) { - TCSoapRunnable* runnable = new TCSoapRunnable(); + ACSoapRunnable* runnable = new ACSoapRunnable(); runnable->SetListenArguments(sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878))); soapThread = new acore::Thread(runnable); }