From f71d894a215ed7cd9052913c9b07c8f62f0e99ca Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 28 Jul 2013 16:59:07 +0100 Subject: Servers: Fix some code style issues in world and authserver --- src/server/authserver/Main.cpp | 69 ++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 36 deletions(-) (limited to 'src/server/authserver/Main.cpp') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 9a80abe55e9..4a44dbfb1c4 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -22,6 +22,7 @@ * This file contains the main program for the * authentication server */ + #include #include #include @@ -54,9 +55,9 @@ LoginDatabaseWorkerPool LoginDatabase; // Accessor to the a class AuthServerSignalHandler : public Trinity::SignalHandler { public: - virtual void HandleSignal(int SigNum) + virtual void HandleSignal(int sigNum) { - switch (SigNum) + switch (sigNum) { case SIGINT: case SIGTERM: @@ -67,7 +68,7 @@ public: }; /// Print out the usage string for this program on the console. -void usage(const char *prog) +void usage(const char* prog) { TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Usage: \n %s []\n" " -c config_file use config_file as configuration file\n\r", @@ -75,37 +76,37 @@ void usage(const char *prog) } /// Launch the auth server -extern int main(int argc, char **argv) +extern int main(int argc, char** argv) { // Command line parsing to get the configuration file name - char const* cfg_file = _TRINITY_REALM_CONFIG; - int c = 1; - while (c < argc) + char const* configFile = _TRINITY_REALM_CONFIG; + int count = 1; + while (count < argc) { - if (strcmp(argv[c], "-c") == 0) + if (strcmp(argv[count], "-c") == 0) { - if (++c >= argc) + if (++count >= argc) { printf("Runtime-Error: -c option requires an input argument\n"); usage(argv[0]); return 1; } else - cfg_file = argv[c]; + configFile = argv[count]; } - ++c; + ++count; } - if (!sConfigMgr->LoadInitial(cfg_file)) + if (!sConfigMgr->LoadInitial(configFile)) { - printf("Invalid or missing configuration file : %s\n", cfg_file); + printf("Invalid or missing configuration file : %s\n", configFile); printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!\n"); return 1; } TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "%s (authserver)", _FULLVERSION); TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " to stop.\n"); - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using configuration file %s.", cfg_file); + TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using configuration file %s.", configFile); TC_LOG_WARN(LOG_FILTER_AUTHSERVER, "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); @@ -118,16 +119,16 @@ extern int main(int argc, char **argv) TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Max allowed open files is %d", ACE::max_handles()); // authserver PID file creation - std::string pidfile = sConfigMgr->GetStringDefault("PidFile", ""); - if (!pidfile.empty()) + std::string pidFile = sConfigMgr->GetStringDefault("PidFile", ""); + if (!pidFile.empty()) { - uint32 pid = CreatePIDFile(pidfile); - if (!pid) + if (uint32 pid = CreatePIDFile(pidFile)) + TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid); + else { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidfile.c_str()); + TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidFile.c_str()); return 1; } - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid); } // Initialize the database connection @@ -162,7 +163,7 @@ extern int main(int argc, char **argv) return 1; } - // Initialise the signal handlers + // Initialize the signal handlers AuthServerSignalHandler SignalINT, SignalTERM; // Register authservers's signal handlers @@ -175,35 +176,31 @@ extern int main(int argc, char **argv) { HANDLE hProcess = GetCurrentProcess(); - uint32 Aff = sConfigMgr->GetIntDefault("UseProcessors", 0); - if (Aff > 0) + uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); + if (affinity > 0) { ULONG_PTR appAff; ULONG_PTR sysAff; if (GetProcessAffinityMask(hProcess, &appAff, &sysAff)) { - ULONG_PTR curAff = Aff & appAff; // remove non accessible processors + ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors - if (!curAff) - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff); - else if (SetProcessAffinityMask(hProcess, curAff)) - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", curAff); + if (!currentAffinity) + TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "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)) + TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", currentAffinity); else - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", curAff); + TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", currentAffinity); } - } - bool Prio = sConfigMgr->GetBoolDefault("ProcessPriority", false); - - if (Prio) + if (bool priority = sConfigMgr->GetBoolDefault("ProcessPriority", false)) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "The auth server process priority class has been set to HIGH"); + TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "authserver process priority class set to HIGH"); else - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set auth server process priority class."); - + TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set authserver process priority class."); } } #endif -- cgit v1.2.3 From e3f7be12efbef67a0d6c7213fba79d09941b2197 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 28 Jul 2013 18:58:12 +0100 Subject: Servers: Enable UseProcessors and ProcessPriority settings to be used on Linux --- src/server/authserver/Main.cpp | 50 ++++++++++++++++++++++++---- src/server/authserver/authserver.conf.dist | 7 ++-- src/server/worldserver/Master.cpp | 39 +++++++++++++++++++--- src/server/worldserver/worldserver.conf.dist | 7 ++-- 4 files changed, 89 insertions(+), 14 deletions(-) (limited to 'src/server/authserver/Main.cpp') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 4a44dbfb1c4..94b2d3c7953 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ + /** * @file main.cpp * @brief Authentication Server main program @@ -40,6 +41,12 @@ #include "RealmList.h" #include "RealmAcceptor.h" +#ifdef __linux__ +#include +#include +#define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0 +#endif + #ifndef _TRINITY_REALM_CONFIG # define _TRINITY_REALM_CONFIG "authserver.conf" #endif @@ -49,7 +56,7 @@ void StopDB(); bool stopEvent = false; // Setting it to true stops the server -LoginDatabaseWorkerPool LoginDatabase; // Accessor to the auth server database +LoginDatabaseWorkerPool LoginDatabase; // Accessor to the authserver database /// Handle authserver's termination signals class AuthServerSignalHandler : public Trinity::SignalHandler @@ -171,12 +178,14 @@ extern int main(int argc, char** argv) Handler.register_handler(SIGINT, &SignalINT); Handler.register_handler(SIGTERM, &SignalTERM); - ///- Handle affinity for multiple processors and process priority on Windows -#ifdef _WIN32 + ///- 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(); - uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); if (affinity > 0) { ULONG_PTR appAff; @@ -187,7 +196,7 @@ extern int main(int argc, char** argv) ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors if (!currentAffinity) - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff); + TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff); else if (SetProcessAffinityMask(hProcess, currentAffinity)) TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", currentAffinity); else @@ -195,7 +204,7 @@ extern int main(int argc, char** argv) } } - if (bool priority = sConfigMgr->GetBoolDefault("ProcessPriority", false)) + if (highPriority) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "authserver process priority class set to HIGH"); @@ -203,6 +212,35 @@ extern int main(int argc, char** argv) TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set authserver process priority class."); } } +#elif __linux__ // Linux + + if (affinity > 0) + { + cpu_set_t mask; + CPU_ZERO(&mask); + + for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i) + if (affinity & (1 << i)) + CPU_SET(i, &mask); + + if (int err = sched_setaffinity(0, sizeof(mask), &mask)) + TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); + else + { + CPU_ZERO(&mask); + sched_getaffinity(0, sizeof(mask), &mask); + TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", *(uint32*)(&mask)) + } + } + + if (highPriority) + { + if (int err = setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) + TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set authserver process priority class, error: %s", strerror(errno)); + else + TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); + } + #endif // maximum counter for next ping diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index dda19c3b849..0a50601f86d 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -71,7 +71,9 @@ PidFile = "" # # UseProcessors -# Description: Processors mask for Windows based multi-processor systems. +# Description: Processors mask for Windows and Linux based multi-processor systems. +# Example: A computer with 2 CPUs: +# 1 - 1st CPU only, 2 - 2nd CPU only, 3 - 1st and 2nd CPU, because 1 | 2 is 3 # Default: 0 - (Selected by OS) # 1+ - (Bit mask value of selected processors) @@ -79,7 +81,8 @@ UseProcessors = 0 # # ProcessPriority -# Description: Process priority setting for Windows based systems. +# Description: Process priority setting for Windows and Linux based systems. +# Details: On Linux, a nice value of -15 is used. On Windows, process is set to HIGH class. # Default: 1 - (High) # 0 - (Normal) diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index c65fc903ffc..b5ef2ad3b9b 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -186,12 +186,14 @@ int Master::Run() ACE_Based::Thread rarThread(new RARunnable); - ///- Handle affinity for multiple processors and process priority on Windows -#ifdef _WIN32 + ///- 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(); - uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); if (affinity > 0) { ULONG_PTR appAff; @@ -210,7 +212,7 @@ int Master::Run() } } - if (bool priority = sConfigMgr->GetBoolDefault("ProcessPriority", false)) + if (highPriority) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to HIGH"); @@ -218,6 +220,35 @@ int Master::Run() TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class."); } } +#elif __linux__ // Linux + + if (affinity > 0) + { + cpu_set_t mask; + CPU_ZERO(&mask); + + for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i) + if (affinity & (1 << i)) + CPU_SET(i, &mask); + + if (int err = sched_setaffinity(0, sizeof(mask), &mask)) + TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); + else + { + CPU_ZERO(&mask); + sched_getaffinity(0, sizeof(mask), &mask); + TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", *(uint32*)(&mask)) + } + } + + if (highPriority) + { + if (int err = setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) + TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class, error: %s", strerror(errno)); + else + TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); + } + #endif //Start soap serving thread diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 9577b3d841f..aac04fe9337 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -149,7 +149,9 @@ BindIP = "0.0.0.0" # PERFORMANCE SETTINGS # # UseProcessors -# Description: Processors mask for Windows based multi-processor systems. +# Description: Processors mask for Windows and Linux based multi-processor systems. +# Example: A computer with 2 CPUs: +# 1 - 1st CPU only, 2 - 2nd CPU only, 3 - 1st and 2nd CPU, because 1 | 2 is 3 # Default: 0 - (Selected by OS) # 1+ - (Bit mask value of selected processors) @@ -157,7 +159,8 @@ UseProcessors = 0 # # ProcessPriority -# Description: Process priority setting for Windows based systems. +# Description: Process priority setting for Windows and Linux based systems. +# Details: On Linux, a nice value of -15 is used. On Windows, process is set to HIGH class. # Default: 1 - (High) # 0 - (Normal) -- cgit v1.2.3 From 3330239a0230a91f4bed9b07c16242387a3c3578 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 28 Jul 2013 20:12:06 +0100 Subject: Servers: Fix typo --- src/server/authserver/Main.cpp | 2 +- src/server/worldserver/Master.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/server/authserver/Main.cpp') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 94b2d3c7953..ac2cf1a80a9 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -229,7 +229,7 @@ extern int main(int argc, char** argv) { CPU_ZERO(&mask); sched_getaffinity(0, sizeof(mask), &mask); - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", *(uint32*)(&mask)) + TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", *(uint32*)(&mask)); } } diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index b5ef2ad3b9b..88a69cf2eb2 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -237,7 +237,7 @@ int Master::Run() { CPU_ZERO(&mask); sched_getaffinity(0, sizeof(mask), &mask); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", *(uint32*)(&mask)) + TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", *(uint32*)(&mask)); } } -- cgit v1.2.3 From 1bb3c4a2b4e3e974f09c0df478245f8daa3a677c Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 29 Jul 2013 14:24:33 +0100 Subject: Misc: Fix warnings and build Closes #10396 --- src/server/authserver/Main.cpp | 4 ++-- src/server/scripts/Spells/spell_dk.cpp | 4 ++-- src/server/scripts/Spells/spell_item.cpp | 4 ++-- src/server/scripts/Spells/spell_priest.cpp | 2 +- src/server/worldserver/Master.cpp | 10 ++++++++-- src/server/worldserver/RemoteAccess/RARunnable.cpp | 3 ++- src/tools/mmaps_generator/MapBuilder.cpp | 4 ++-- 7 files changed, 19 insertions(+), 12 deletions(-) (limited to 'src/server/authserver/Main.cpp') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index ac2cf1a80a9..9a6cc89fdd4 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -223,7 +223,7 @@ extern int main(int argc, char** argv) if (affinity & (1 << i)) CPU_SET(i, &mask); - if (int err = sched_setaffinity(0, sizeof(mask), &mask)) + if (sched_setaffinity(0, sizeof(mask), &mask)) TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); else { @@ -235,7 +235,7 @@ extern int main(int argc, char** argv) if (highPriority) { - if (int err = setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) + if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set authserver process priority class, error: %s", strerror(errno)); else TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index eb7ccc54c37..e1305d71b73 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -930,7 +930,7 @@ class spell_dk_presence : public SpellScriptLoader { AfterEffectApply += AuraEffectApplyFn(spell_dk_presence_AuraScript::HandleImprovedBloodPresence, EFFECT_0, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); AfterEffectApply += AuraEffectApplyFn(spell_dk_presence_AuraScript::HandleImprovedFrostPresence, EFFECT_0, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); - AfterEffectApply += AuraEffectApplyFn(spell_dk_presence_AuraScript::HandleImprovedUnholyPresence, EFFECT_0, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + AfterEffectApply += AuraEffectApplyFn(spell_dk_presence_AuraScript::HandleImprovedUnholyPresence, EFFECT_0, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); AfterEffectRemove += AuraEffectRemoveFn(spell_dk_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); } }; @@ -985,7 +985,7 @@ class spell_dk_scent_of_blood : public SpellScriptLoader return true; } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) { PreventDefaultAction(); GetTarget()->CastSpell(GetTarget(), SPELL_DK_SCENT_OF_BLOOD, true, NULL, aurEff); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 64fc835bff9..09be427d330 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -95,7 +95,7 @@ class spell_item_aegis_of_preservation : public SpellScriptLoader return true; } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) { PreventDefaultAction(); GetTarget()->CastSpell(GetTarget(), SPELL_AEGIS_HEAL, true, NULL, aurEff); @@ -279,7 +279,7 @@ class spell_item_desperate_defense : public SpellScriptLoader return true; } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) { PreventDefaultAction(); GetTarget()->CastSpell(GetTarget(), SPELL_DESPERATE_RAGE, true, NULL, aurEff); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 8d43f8e01fc..0d3da30377a 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -215,7 +215,7 @@ class spell_pri_item_greater_heal_refund : public SpellScriptLoader return true; } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) { PreventDefaultAction(); GetTarget()->CastSpell(GetTarget(), SPELL_PRIEST_ITEM_EFFICIENCY, true, NULL, aurEff); diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 88a69cf2eb2..6fd57179140 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -50,6 +50,12 @@ extern int m_ServiceStatus; #endif +#ifdef __linux__ +#include +#include +#define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0 +#endif + /// Handle worldservers's termination signals class WorldServerSignalHandler : public Trinity::SignalHandler { @@ -231,7 +237,7 @@ int Master::Run() if (affinity & (1 << i)) CPU_SET(i, &mask); - if (int err = sched_setaffinity(0, sizeof(mask), &mask)) + if (sched_setaffinity(0, sizeof(mask), &mask)) TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); else { @@ -243,7 +249,7 @@ int Master::Run() if (highPriority) { - if (int err = setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) + if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class, error: %s", strerror(errno)); else TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp index c381c65e9e2..1493df7aa2f 100644 --- a/src/server/worldserver/RemoteAccess/RARunnable.cpp +++ b/src/server/worldserver/RemoteAccess/RARunnable.cpp @@ -75,7 +75,8 @@ void RARunnable::run() while (!World::IsStopped()) { - if (m_Reactor->run_reactor_event_loop(ACE_Time_Value(0, 100000)) == -1) + ACE_Time_Value interval(0, 100000); + if (m_Reactor->run_reactor_event_loop(interval) == -1) break; } diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index 9dfdf95643d..06a764690ca 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -716,8 +716,8 @@ namespace MMAP params.cs = config.cs; params.ch = config.ch; params.tileLayer = 0; - params.buildBvTree = true; - + params.buildBvTree = true; + // will hold final navmesh unsigned char* navData = NULL; int navDataSize = 0; -- cgit v1.2.3