chore(Core/Worldserver): restyle worldserver lib with astyle (#3463)
This commit is contained in:
@@ -35,7 +35,7 @@ void ACSoapRunnable::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, "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);
|
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
|
||||||
|
|
||||||
@@ -151,7 +151,8 @@ void SOAPCommand::commandFinished(void* soapconnection, bool success)
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct Namespace namespaces[] =
|
struct Namespace namespaces[] =
|
||||||
{ { "SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", nullptr, nullptr }, // must be first
|
{
|
||||||
|
{ "SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", nullptr, nullptr }, // must be first
|
||||||
{ "SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", nullptr, nullptr }, // must be second
|
{ "SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", nullptr, nullptr }, // 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 },
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
class ACSoapRunnable : public acore::Runnable
|
class ACSoapRunnable : public acore::Runnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ACSoapRunnable() : _port(0) { }
|
ACSoapRunnable() : _port(0) { }
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
@@ -27,7 +27,7 @@ class ACSoapRunnable : public acore::Runnable
|
|||||||
_port = port;
|
_port = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void process_message(ACE_Message_Block* mb);
|
void process_message(ACE_Message_Block* mb);
|
||||||
|
|
||||||
std::string _host;
|
std::string _host;
|
||||||
@@ -36,7 +36,7 @@ class ACSoapRunnable : public acore::Runnable
|
|||||||
|
|
||||||
class SOAPCommand
|
class SOAPCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SOAPCommand(): pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false) {}
|
SOAPCommand(): pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false) {}
|
||||||
|
|
||||||
~SOAPCommand() { }
|
~SOAPCommand() { }
|
||||||
|
|||||||
@@ -81,18 +81,18 @@ void utf8print(void* /*arg*/, const char* str)
|
|||||||
{
|
{
|
||||||
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
|
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
|
||||||
wchar_t wtemp_buf[6000];
|
wchar_t wtemp_buf[6000];
|
||||||
size_t wtemp_len = 6000-1;
|
size_t wtemp_len = 6000 - 1;
|
||||||
if (!Utf8toWStr(str, strlen(str), wtemp_buf, wtemp_len))
|
if (!Utf8toWStr(str, strlen(str), wtemp_buf, wtemp_len))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char temp_buf[6000];
|
char temp_buf[6000];
|
||||||
CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], wtemp_len+1);
|
CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], wtemp_len + 1);
|
||||||
printf(temp_buf);
|
printf(temp_buf);
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
printf("%s", str);
|
printf("%s", str);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ int kb_hit_return()
|
|||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(STDIN_FILENO, &fds);
|
FD_SET(STDIN_FILENO, &fds);
|
||||||
select(STDIN_FILENO+1, &fds, nullptr, nullptr, &tv);
|
select(STDIN_FILENO + 1, &fds, nullptr, nullptr, &tv);
|
||||||
return FD_ISSET(STDIN_FILENO, &fds);
|
return FD_ISSET(STDIN_FILENO, &fds);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -139,7 +139,7 @@ void CliRunnable::run()
|
|||||||
{
|
{
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
char *command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin);
|
char* command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin);
|
||||||
|
|
||||||
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
|
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
|
||||||
char commandbuf[256];
|
char commandbuf[256];
|
||||||
@@ -151,7 +151,7 @@ void CliRunnable::run()
|
|||||||
|
|
||||||
if (command_str != nullptr)
|
if (command_str != nullptr)
|
||||||
{
|
{
|
||||||
for (int x=0; command_str[x]; ++x)
|
for (int x = 0; command_str[x]; ++x)
|
||||||
if (command_str[x] == '\r' || command_str[x] == '\n')
|
if (command_str[x] == '\r' || command_str[x] == '\n')
|
||||||
{
|
{
|
||||||
command_str[x] = 0;
|
command_str[x] = 0;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
/// Command Line Interface handling thread
|
/// Command Line Interface handling thread
|
||||||
class CliRunnable : public acore::Runnable
|
class CliRunnable : public acore::Runnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void run();
|
void run();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ extern int main(int argc, char** argv)
|
|||||||
configFile = argv[c];
|
configFile = argv[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (strcmp(argv[c], "-s") == 0) // Services
|
if (strcmp(argv[c], "-s") == 0) // Services
|
||||||
{
|
{
|
||||||
if (++c >= argc)
|
if (++c >= argc)
|
||||||
@@ -114,7 +114,7 @@ extern int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (strcmp(argv[c], "--service") == 0)
|
if (strcmp(argv[c], "--service") == 0)
|
||||||
WinServiceRun();
|
WinServiceRun();
|
||||||
#endif
|
#endif
|
||||||
++c;
|
++c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ extern int m_ServiceStatus;
|
|||||||
/// Handle worldservers's termination signals
|
/// Handle worldservers's termination signals
|
||||||
class WorldServerSignalHandler : public acore::SignalHandler
|
class WorldServerSignalHandler : public acore::SignalHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void HandleSignal(int sigNum)
|
virtual void HandleSignal(int sigNum)
|
||||||
{
|
{
|
||||||
switch (sigNum)
|
switch (sigNum)
|
||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
if (!_delayTime)
|
if (!_delayTime)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sLog->outString("Starting up anti-freeze thread (%u seconds max stuck time)...", _delayTime/1000);
|
sLog->outString("Starting up anti-freeze thread (%u seconds max stuck time)...", _delayTime / 1000);
|
||||||
while (!World::IsStopped())
|
while (!World::IsStopped())
|
||||||
{
|
{
|
||||||
uint32 curtime = getMSTime();
|
uint32 curtime = getMSTime();
|
||||||
@@ -166,9 +166,9 @@ int Master::Run()
|
|||||||
|
|
||||||
///- Initialize the signal handlers
|
///- Initialize the signal handlers
|
||||||
WorldServerSignalHandler signalINT, signalTERM; //, signalSEGV
|
WorldServerSignalHandler signalINT, signalTERM; //, signalSEGV
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WorldServerSignalHandler signalBREAK;
|
WorldServerSignalHandler signalBREAK;
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
///- Register worldserver's signal handlers
|
///- Register worldserver's signal handlers
|
||||||
ACE_Sig_Handler handle;
|
ACE_Sig_Handler handle;
|
||||||
@@ -283,7 +283,7 @@ int Master::Run()
|
|||||||
acore::Thread* freezeThread = nullptr;
|
acore::Thread* freezeThread = nullptr;
|
||||||
if (uint32 freezeDelay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0))
|
if (uint32 freezeDelay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0))
|
||||||
{
|
{
|
||||||
FreezeDetectorRunnable* runnable = new FreezeDetectorRunnable(freezeDelay*1000);
|
FreezeDetectorRunnable* runnable = new FreezeDetectorRunnable(freezeDelay * 1000);
|
||||||
freezeThread = new acore::Thread(runnable);
|
freezeThread = new acore::Thread(runnable);
|
||||||
freezeThread->setPriority(acore::Priority_Highest);
|
freezeThread->setPriority(acore::Priority_Highest);
|
||||||
}
|
}
|
||||||
@@ -334,7 +334,7 @@ int Master::Run()
|
|||||||
|
|
||||||
if (cliThread)
|
if (cliThread)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
// this only way to terminate CLI thread exist at Win32 (alt. way exist only in Windows Vista API)
|
// this only way to terminate CLI thread exist at Win32 (alt. way exist only in Windows Vista API)
|
||||||
//_exit(1);
|
//_exit(1);
|
||||||
@@ -373,11 +373,11 @@ int Master::Run()
|
|||||||
|
|
||||||
cliThread->wait();
|
cliThread->wait();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
cliThread->destroy();
|
cliThread->destroy();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete cliThread;
|
delete cliThread;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,11 @@
|
|||||||
/// Start the server
|
/// Start the server
|
||||||
class Master
|
class Master
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Master* instance();
|
static Master* instance();
|
||||||
int Run();
|
int Run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _StartDB();
|
bool _StartDB();
|
||||||
void _StopDB();
|
void _StopDB();
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ RASocket::RASocket()
|
|||||||
_commandExecuting = false;
|
_commandExecuting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RASocket::open(void *)
|
int RASocket::open(void*)
|
||||||
{
|
{
|
||||||
ACE_INET_Addr remoteAddress;
|
ACE_INET_Addr remoteAddress;
|
||||||
|
|
||||||
@@ -135,7 +135,8 @@ int RASocket::process_command(const std::string& command)
|
|||||||
sLog->outRemote("Got command: %s", command.c_str());
|
sLog->outRemote("Got command: %s", command.c_str());
|
||||||
|
|
||||||
// handle quit, exit and logout commands to terminate connection
|
// handle quit, exit and logout commands to terminate connection
|
||||||
if (command == "quit" || command == "exit" || command == "logout") {
|
if (command == "quit" || command == "exit" || command == "logout")
|
||||||
|
{
|
||||||
(void) send("Bye\r\n");
|
(void) send("Bye\r\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -291,7 +292,7 @@ int RASocket::subnegotiate()
|
|||||||
|
|
||||||
buf[n] = '\0';
|
buf[n] = '\0';
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
for (uint8 i = 0; i < n; )
|
for (uint8 i = 0; i < n; )
|
||||||
{
|
{
|
||||||
uint8 iac = buf[i];
|
uint8 iac = buf[i];
|
||||||
@@ -323,7 +324,7 @@ int RASocket::subnegotiate()
|
|||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! Just send back end of subnegotiation packet
|
//! Just send back end of subnegotiation packet
|
||||||
uint8 const reply[2] = {0xFF, 0xF0};
|
uint8 const reply[2] = {0xFF, 0xF0};
|
||||||
@@ -371,7 +372,7 @@ int RASocket::svc(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RASocket::zprint(void* callbackArg, const char * szText)
|
void RASocket::zprint(void* callbackArg, const char* szText)
|
||||||
{
|
{
|
||||||
if (!szText || !callbackArg)
|
if (!szText || !callbackArg)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
/// Remote Administration socket
|
/// Remote Administration socket
|
||||||
class RASocket : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
|
class RASocket : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RASocket();
|
RASocket();
|
||||||
virtual ~RASocket() { }
|
virtual ~RASocket() { }
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ class RASocket : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
|
|||||||
virtual int open(void* = 0);
|
virtual int open(void* = 0);
|
||||||
virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
|
virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int recv_line(std::string& outLine);
|
int recv_line(std::string& outLine);
|
||||||
int recv_line(ACE_Message_Block& buffer);
|
int recv_line(ACE_Message_Block& buffer);
|
||||||
int process_command(const std::string& command);
|
int process_command(const std::string& command);
|
||||||
@@ -43,7 +43,7 @@ class RASocket : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
|
|||||||
static void zprint(void* callbackArg, const char* szText);
|
static void zprint(void* callbackArg, const char* szText);
|
||||||
static void commandFinished(void* callbackArg, bool success);
|
static void commandFinished(void* callbackArg, bool success);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8 _minLevel; ///< Minimum security level required to connect
|
uint8 _minLevel; ///< Minimum security level required to connect
|
||||||
std::atomic_long _commandExecuting;
|
std::atomic_long _commandExecuting;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,15 +53,15 @@ void WorldRunnable::run()
|
|||||||
avgDiffTracker.Update(executionTimeDiff > WORLD_SLEEP_CONST ? executionTimeDiff : WORLD_SLEEP_CONST);
|
avgDiffTracker.Update(executionTimeDiff > WORLD_SLEEP_CONST ? executionTimeDiff : WORLD_SLEEP_CONST);
|
||||||
|
|
||||||
if (executionTimeDiff < WORLD_SLEEP_CONST)
|
if (executionTimeDiff < WORLD_SLEEP_CONST)
|
||||||
acore::Thread::Sleep(WORLD_SLEEP_CONST-executionTimeDiff);
|
acore::Thread::Sleep(WORLD_SLEEP_CONST - executionTimeDiff);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (m_ServiceStatus == 0)
|
if (m_ServiceStatus == 0)
|
||||||
World::StopNow(SHUTDOWN_EXIT_CODE);
|
World::StopNow(SHUTDOWN_EXIT_CODE);
|
||||||
|
|
||||||
while (m_ServiceStatus == 2)
|
while (m_ServiceStatus == 2)
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
sLog->SetLogDB(false);
|
sLog->SetLogDB(false);
|
||||||
|
|||||||
@@ -14,13 +14,13 @@
|
|||||||
/// Heartbeat thread for the World
|
/// Heartbeat thread for the World
|
||||||
class WorldRunnable : public acore::Runnable
|
class WorldRunnable : public acore::Runnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void run();
|
void run();
|
||||||
};
|
};
|
||||||
|
|
||||||
class AuctionListingRunnable : public acore::Runnable
|
class AuctionListingRunnable : public acore::Runnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void run();
|
void run();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user