chore(Core/Worldserver): restyle worldserver lib with astyle (#3463)

This commit is contained in:
Kargatum
2020-09-11 10:41:31 +07:00
committed by GitHub
parent c141be8684
commit d47d6d34f3
11 changed files with 139 additions and 137 deletions
+3 -2
View File
@@ -35,7 +35,7 @@ void ACSoapRunnable::run()
continue; // ran into an accept timeout
#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
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[] =
{ { "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
{ "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 },
+3 -3
View File
@@ -16,7 +16,7 @@
class ACSoapRunnable : public acore::Runnable
{
public:
public:
ACSoapRunnable() : _port(0) { }
void run();
@@ -27,7 +27,7 @@ class ACSoapRunnable : public acore::Runnable
_port = port;
}
private:
private:
void process_message(ACE_Message_Block* mb);
std::string _host;
@@ -36,7 +36,7 @@ class ACSoapRunnable : public acore::Runnable
class SOAPCommand
{
public:
public:
SOAPCommand(): pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false) {}
~SOAPCommand() { }
@@ -81,18 +81,18 @@ void utf8print(void* /*arg*/, const char* str)
{
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
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))
return;
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);
#else
{
{
printf("%s", str);
fflush(stdout);
}
}
#endif
}
@@ -112,7 +112,7 @@ int kb_hit_return()
tv.tv_usec = 0;
FD_ZERO(&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);
}
#endif
@@ -139,7 +139,7 @@ void CliRunnable::run()
{
fflush(stdout);
char *command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin);
char* command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin);
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
char commandbuf[256];
@@ -151,7 +151,7 @@ void CliRunnable::run()
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')
{
command_str[x] = 0;
@@ -14,7 +14,7 @@
/// Command Line Interface handling thread
class CliRunnable : public acore::Runnable
{
public:
public:
void run();
};
+2 -2
View File
@@ -82,7 +82,7 @@ extern int main(int argc, char** argv)
configFile = argv[c];
}
#ifdef _WIN32
#ifdef _WIN32
if (strcmp(argv[c], "-s") == 0) // Services
{
if (++c >= argc)
@@ -114,7 +114,7 @@ extern int main(int argc, char** argv)
if (strcmp(argv[c], "--service") == 0)
WinServiceRun();
#endif
#endif
++c;
}
+8 -8
View File
@@ -46,7 +46,7 @@ extern int m_ServiceStatus;
/// Handle worldservers's termination signals
class WorldServerSignalHandler : public acore::SignalHandler
{
public:
public:
virtual void HandleSignal(int sigNum)
{
switch (sigNum)
@@ -84,7 +84,7 @@ public:
if (!_delayTime)
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())
{
uint32 curtime = getMSTime();
@@ -166,9 +166,9 @@ int Master::Run()
///- Initialize the signal handlers
WorldServerSignalHandler signalINT, signalTERM; //, signalSEGV
#ifdef _WIN32
#ifdef _WIN32
WorldServerSignalHandler signalBREAK;
#endif /* _WIN32 */
#endif /* _WIN32 */
///- Register worldserver's signal handlers
ACE_Sig_Handler handle;
@@ -283,7 +283,7 @@ int Master::Run()
acore::Thread* freezeThread = nullptr;
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->setPriority(acore::Priority_Highest);
}
@@ -334,7 +334,7 @@ int Master::Run()
if (cliThread)
{
#ifdef _WIN32
#ifdef _WIN32
// this only way to terminate CLI thread exist at Win32 (alt. way exist only in Windows Vista API)
//_exit(1);
@@ -373,11 +373,11 @@ int Master::Run()
cliThread->wait();
#else
#else
cliThread->destroy();
#endif
#endif
delete cliThread;
}
+2 -2
View File
@@ -16,11 +16,11 @@
/// Start the server
class Master
{
public:
public:
static Master* instance();
int Run();
private:
private:
bool _StartDB();
void _StopDB();
@@ -25,7 +25,7 @@ RASocket::RASocket()
_commandExecuting = false;
}
int RASocket::open(void *)
int RASocket::open(void*)
{
ACE_INET_Addr remoteAddress;
@@ -135,7 +135,8 @@ int RASocket::process_command(const std::string& command)
sLog->outRemote("Got command: %s", command.c_str());
// 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");
return -1;
}
@@ -291,7 +292,7 @@ int RASocket::subnegotiate()
buf[n] = '\0';
#ifdef _DEBUG
#ifdef _DEBUG
for (uint8 i = 0; i < n; )
{
uint8 iac = buf[i];
@@ -323,7 +324,7 @@ int RASocket::subnegotiate()
}
++i;
}
#endif
#endif
//! Just send back end of subnegotiation packet
uint8 const reply[2] = {0xFF, 0xF0};
@@ -371,7 +372,7 @@ int RASocket::svc(void)
return 0;
}
void RASocket::zprint(void* callbackArg, const char * szText)
void RASocket::zprint(void* callbackArg, const char* szText)
{
if (!szText || !callbackArg)
return;
@@ -22,7 +22,7 @@
/// Remote Administration socket
class RASocket : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
{
public:
public:
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 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(ACE_Message_Block& buffer);
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 commandFinished(void* callbackArg, bool success);
private:
private:
uint8 _minLevel; ///< Minimum security level required to connect
std::atomic_long _commandExecuting;
};
@@ -53,15 +53,15 @@ void WorldRunnable::run()
avgDiffTracker.Update(executionTimeDiff > WORLD_SLEEP_CONST ? 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)
World::StopNow(SHUTDOWN_EXIT_CODE);
while (m_ServiceStatus == 2)
Sleep(1000);
#endif
#endif
}
sLog->SetLogDB(false);
@@ -14,13 +14,13 @@
/// Heartbeat thread for the World
class WorldRunnable : public acore::Runnable
{
public:
public:
void run();
};
class AuctionListingRunnable : public acore::Runnable
{
public:
public:
void run();
};
#endif