mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 00:08:01 +00:00
chore(Core/Soap): Renamed TCSoap to ACSoap (#2509)
This commit is contained in:
committed by
Stoabrogga
parent
0a9f230f83
commit
5198b2614e
@@ -4,13 +4,13 @@
|
|||||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TCSoap.h"
|
#include "ACSoap.h"
|
||||||
#include "soapH.h"
|
#include "soapH.h"
|
||||||
#include "soapStub.h"
|
#include "soapStub.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
void TCSoapRunnable::run()
|
void ACSoapRunnable::run()
|
||||||
{
|
{
|
||||||
struct soap soap;
|
struct soap soap;
|
||||||
soap_init(&soap);
|
soap_init(&soap);
|
||||||
@@ -23,11 +23,11 @@ void TCSoapRunnable::run()
|
|||||||
soap.send_timeout = 5;
|
soap.send_timeout = 5;
|
||||||
if (!soap_valid_socket(soap_bind(&soap, _host.c_str(), _port, 100)))
|
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);
|
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())
|
while (!World::IsStopped())
|
||||||
{
|
{
|
||||||
@@ -35,7 +35,7 @@ void TCSoapRunnable::run()
|
|||||||
continue; // ran into an accept timeout
|
continue; // ran into an accept timeout
|
||||||
|
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#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
|
#endif
|
||||||
struct soap* thread_soap = soap_copy(&soap);// make a safe copy
|
struct soap* thread_soap = soap_copy(&soap);// make a safe copy
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ void TCSoapRunnable::run()
|
|||||||
soap_done(&soap);
|
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"));
|
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 (!soap->userid || !soap->passwd)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#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
|
#endif
|
||||||
return 401;
|
return 401;
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
|
|||||||
if (!accountId)
|
if (!accountId)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#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
|
#endif
|
||||||
return 401;
|
return 401;
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
|
|||||||
if (!AccountMgr::CheckPassword(accountId, soap->passwd))
|
if (!AccountMgr::CheckPassword(accountId, soap->passwd))
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#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
|
#endif
|
||||||
return 401;
|
return 401;
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
|
|||||||
if (AccountMgr::GetSecurity(accountId) < SEC_ADMINISTRATOR)
|
if (AccountMgr::GetSecurity(accountId) < SEC_ADMINISTRATOR)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#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
|
#endif
|
||||||
return 403;
|
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");
|
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)
|
#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
|
#endif
|
||||||
SOAPCommand connection;
|
SOAPCommand connection;
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
|
|||||||
int acc = connection.pendingCommands.acquire();
|
int acc = connection.pendingCommands.acquire();
|
||||||
if (acc)
|
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
|
// alright, command finished
|
||||||
@@ -155,6 +155,6 @@ struct Namespace namespaces[] =
|
|||||||
{ "SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", NULL, NULL }, // must be second
|
{ "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 },
|
{ "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 },
|
{ "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 }
|
{ NULL, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _TCSOAP_H
|
#ifndef _ACSOAP_H
|
||||||
#define _TCSOAP_H
|
#define _ACSOAP_H
|
||||||
|
|
||||||
#include "Define.h"
|
#include "Define.h"
|
||||||
#include "AccountMgr.h"
|
#include "AccountMgr.h"
|
||||||
@@ -14,10 +14,10 @@
|
|||||||
#include <ace/Task.h>
|
#include <ace/Task.h>
|
||||||
#include <Threading.h>
|
#include <Threading.h>
|
||||||
|
|
||||||
class TCSoapRunnable : public acore::Runnable
|
class ACSoapRunnable : public acore::Runnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TCSoapRunnable() : _port(0) { }
|
ACSoapRunnable() : _port(0) { }
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
@@ -37,14 +37,9 @@ class TCSoapRunnable : public acore::Runnable
|
|||||||
class SOAPCommand
|
class SOAPCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SOAPCommand():
|
SOAPCommand(): pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false) {}
|
||||||
pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~SOAPCommand()
|
~SOAPCommand() { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void appendToPrintBuffer(const char* msg)
|
void appendToPrintBuffer(const char* msg)
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Master.h"
|
#include "Master.h"
|
||||||
#include "RARunnable.h"
|
#include "RARunnable.h"
|
||||||
#include "TCSoap.h"
|
#include "ACSoap.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "RealmList.h"
|
#include "RealmList.h"
|
||||||
@@ -121,16 +121,16 @@ int Master::Run()
|
|||||||
sLog->outString("%s (worldserver-daemon)", GitRevision::GetFullVersion());
|
sLog->outString("%s (worldserver-daemon)", GitRevision::GetFullVersion());
|
||||||
sLog->outString("<Ctrl-C> to stop.\n");
|
sLog->outString("<Ctrl-C> 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(" ██║ ██║ ██║██╔══██╗██╔══╝");
|
||||||
sLog->outString(" ╚██████╗╚██████╔╝██║ ██║███████╗");
|
sLog->outString(" ╚██████╗╚██████╔╝██║ ██║███████╗");
|
||||||
sLog->outString(" ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝\n");
|
sLog->outString(" ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝\n");
|
||||||
|
|
||||||
@@ -202,25 +202,25 @@ int Master::Run()
|
|||||||
auctionLising_thread.setPriority(acore::Priority_High);
|
auctionLising_thread.setPriority(acore::Priority_High);
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__linux__)
|
#if defined(_WIN32) || defined(__linux__)
|
||||||
|
|
||||||
|
|
||||||
///- Handle affinity for multiple processors and process priority
|
///- Handle affinity for multiple processors and process priority
|
||||||
uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0);
|
uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0);
|
||||||
bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false);
|
bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false);
|
||||||
|
|
||||||
#ifdef _WIN32 // Windows
|
#ifdef _WIN32 // Windows
|
||||||
|
|
||||||
HANDLE hProcess = GetCurrentProcess();
|
HANDLE hProcess = GetCurrentProcess();
|
||||||
|
|
||||||
if (affinity > 0)
|
if (affinity > 0)
|
||||||
{
|
{
|
||||||
ULONG_PTR appAff;
|
ULONG_PTR appAff;
|
||||||
ULONG_PTR sysAff;
|
ULONG_PTR sysAff;
|
||||||
|
|
||||||
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
|
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
|
||||||
{
|
{
|
||||||
ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors
|
ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors
|
||||||
|
|
||||||
if (!currentAffinity)
|
if (!currentAffinity)
|
||||||
sLog->outError("Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff);
|
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))
|
else if (SetProcessAffinityMask(hProcess, currentAffinity))
|
||||||
@@ -229,7 +229,7 @@ int Master::Run()
|
|||||||
sLog->outError("Can't set used processors (hex): %x", currentAffinity);
|
sLog->outError("Can't set used processors (hex): %x", currentAffinity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (highPriority)
|
if (highPriority)
|
||||||
{
|
{
|
||||||
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
|
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
|
||||||
@@ -237,9 +237,9 @@ int Master::Run()
|
|||||||
else
|
else
|
||||||
sLog->outError("Can't set worldserver process priority class.");
|
sLog->outError("Can't set worldserver process priority class.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // Linux
|
#else // Linux
|
||||||
|
|
||||||
if (affinity > 0)
|
if (affinity > 0)
|
||||||
{
|
{
|
||||||
cpu_set_t mask;
|
cpu_set_t mask;
|
||||||
@@ -266,7 +266,7 @@ int Master::Run()
|
|||||||
else
|
else
|
||||||
sLog->outString("worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0));
|
sLog->outString("worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ int Master::Run()
|
|||||||
acore::Thread* soapThread = NULL;
|
acore::Thread* soapThread = NULL;
|
||||||
if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false))
|
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)));
|
runnable->SetListenArguments(sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878)));
|
||||||
soapThread = new acore::Thread(runnable);
|
soapThread = new acore::Thread(runnable);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user