mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Remove trailing whitespace
This commit is contained in:
@@ -16,7 +16,7 @@ ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
|
||||
TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
|
||||
|
||||
SET_TARGET_PROPERTIES(eqlaunch PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
TARGET_LINK_LIBRARIES(eqlaunch "Ws2_32.lib")
|
||||
ENDIF(MSVC)
|
||||
|
||||
+13
-13
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -33,7 +33,7 @@ void ZoneLaunch::InitStartTimer() {
|
||||
s_startTimer.Trigger();
|
||||
}
|
||||
|
||||
ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name,
|
||||
ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name,
|
||||
const char *zone_name, const EQEmuConfig *config)
|
||||
: m_state(StateStartPending),
|
||||
m_world(world),
|
||||
@@ -68,7 +68,7 @@ void ZoneLaunch::Start() {
|
||||
spec->args.push_back(m_launcherName);
|
||||
spec->handler = this;
|
||||
spec->logFile = m_config->LogPrefix + m_zone + m_config->LogSuffix;
|
||||
|
||||
|
||||
//spec is consumed, even on failure
|
||||
m_ref = ProcLauncher::get()->Launch(spec);
|
||||
if(m_ref == ProcLauncher::ProcError) {
|
||||
@@ -76,14 +76,14 @@ void ZoneLaunch::Start() {
|
||||
m_timer.Start(m_config->RestartWait);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
m_startCount++;
|
||||
m_state = StateStarted;
|
||||
s_running++;
|
||||
m_killFails = 0;
|
||||
|
||||
|
||||
SendStatus();
|
||||
|
||||
|
||||
_log(LAUNCHER__STATUS, "Zone %s has been started.", m_zone.c_str());
|
||||
}
|
||||
|
||||
@@ -158,15 +158,15 @@ bool ZoneLaunch::Process() {
|
||||
//we have to wait on the shared timer now..
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//ok, both timers say we can start.
|
||||
//disable our internal timer, will get started again if it is needed.
|
||||
m_timer.Disable();
|
||||
|
||||
|
||||
//actually start up the program
|
||||
_log(LAUNCHER__STATUS, "Starting zone %s", m_zone.c_str());
|
||||
Start();
|
||||
|
||||
|
||||
//now update the shared timer to reflect the proper start interval.
|
||||
if(s_running == 1) {
|
||||
//we are the first zone started. wait that interval.
|
||||
@@ -177,7 +177,7 @@ bool ZoneLaunch::Process() {
|
||||
_log(LAUNCHER__STATUS, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval);
|
||||
s_startTimer.Start(m_config->ZoneBootInterval);
|
||||
}
|
||||
|
||||
|
||||
} //else, timer still ticking, keep waiting
|
||||
break;
|
||||
case StateStarted:
|
||||
@@ -218,7 +218,7 @@ bool ZoneLaunch::Process() {
|
||||
//called when the process actually dies off...
|
||||
void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLauncher::Spec *spec) {
|
||||
s_running--;
|
||||
|
||||
|
||||
switch(m_state) {
|
||||
case StateStartPending:
|
||||
_log(LAUNCHER__STATUS, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str());
|
||||
@@ -246,7 +246,7 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche
|
||||
_log(LAUNCHER__STATUS, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
SendStatus();
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -30,27 +30,27 @@ public:
|
||||
ZoneLaunch(WorldServer *world, const char *launcher_name,
|
||||
const char *zone_name, const EQEmuConfig *config);
|
||||
virtual ~ZoneLaunch();
|
||||
|
||||
|
||||
void Stop(bool graceful = true);
|
||||
void Restart();
|
||||
|
||||
|
||||
bool Process();
|
||||
|
||||
|
||||
void SendStatus() const;
|
||||
|
||||
|
||||
const char *GetZone() const { return(m_zone.c_str()); }
|
||||
uint32 GetStartCount() const { return(m_startCount); }
|
||||
|
||||
|
||||
//should only be called during process init to setup the start timer.
|
||||
static void InitStartTimer();
|
||||
|
||||
|
||||
protected:
|
||||
bool IsRunning() const { return(m_state == StateStarted || m_state == StateStopPending || m_state == StateRestartPending); }
|
||||
|
||||
|
||||
void Start();
|
||||
|
||||
|
||||
void OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLauncher::Spec *spec);
|
||||
|
||||
|
||||
enum {
|
||||
StateStartPending,
|
||||
StateStarted,
|
||||
@@ -58,18 +58,18 @@ protected:
|
||||
StateStopPending,
|
||||
StateStopped
|
||||
} m_state;
|
||||
|
||||
|
||||
WorldServer *const m_world;
|
||||
const std::string m_zone;
|
||||
const char *const m_launcherName;
|
||||
const EQEmuConfig *const m_config;
|
||||
|
||||
|
||||
Timer m_timer;
|
||||
ProcLauncher::ProcRef m_ref;
|
||||
uint32 m_startCount;
|
||||
|
||||
|
||||
uint32 m_killFails;
|
||||
|
||||
|
||||
private:
|
||||
static int s_running;
|
||||
static Timer s_startTimer;
|
||||
|
||||
+20
-20
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -48,14 +48,14 @@ int main(int argc, char *argv[]) {
|
||||
_log(LAUNCHER__ERROR, "You must specfify a launcher name as the first argument to this program.");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
_log(LAUNCHER__INIT, "Loading server configuration..");
|
||||
if (!EQEmuConfig::LoadConfig()) {
|
||||
_log(LAUNCHER__ERROR, "Loading server configuration failed.");
|
||||
return(1);
|
||||
}
|
||||
const EQEmuConfig *Config = EQEmuConfig::get();
|
||||
|
||||
|
||||
/*
|
||||
* Setup nice signal handlers
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ int main(int argc, char *argv[]) {
|
||||
_log(LAUNCHER__ERROR, "Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add '.' to LD_LIBRARY_PATH
|
||||
*/
|
||||
@@ -86,38 +86,38 @@ int main(int argc, char *argv[]) {
|
||||
putenv(v);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
map<string, ZoneLaunch *> zones;
|
||||
WorldServer world(zones, launcher_name.c_str(), Config);
|
||||
if (!world.Connect()) {
|
||||
_log(LAUNCHER__ERROR, "worldserver.Connect() FAILED! Will retry.");
|
||||
}
|
||||
|
||||
|
||||
map<string, ZoneLaunch *>::iterator zone, zend;
|
||||
set<string> to_remove;
|
||||
|
||||
|
||||
Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect
|
||||
|
||||
|
||||
_log(LAUNCHER__INIT, "Starting main loop...");
|
||||
|
||||
|
||||
// zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1");
|
||||
|
||||
|
||||
ProcLauncher *launch = ProcLauncher::get();
|
||||
RunLoops = true;
|
||||
while(RunLoops) {
|
||||
//Advance the timer to our current point in time
|
||||
Timer::SetCurrentTime();
|
||||
|
||||
|
||||
/*
|
||||
* Process the world connection
|
||||
*/
|
||||
world.Process();
|
||||
|
||||
|
||||
/*
|
||||
* Let the process manager look for dead children
|
||||
*/
|
||||
launch->Process();
|
||||
|
||||
|
||||
/*
|
||||
* Give all zones a chance to process.
|
||||
*/
|
||||
@@ -127,7 +127,7 @@ int main(int argc, char *argv[]) {
|
||||
if(!zone->second->Process())
|
||||
to_remove.insert(zone->first);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Kill off any zones which have stopped
|
||||
*/
|
||||
@@ -142,13 +142,13 @@ int main(int argc, char *argv[]) {
|
||||
delete zone->second;
|
||||
zones.erase(rem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (InterserverTimer.Check()) {
|
||||
if (world.TryReconnect() && (!world.Connected()))
|
||||
world.AsyncConnect();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Take a nice nap until next cycle
|
||||
*/
|
||||
@@ -157,7 +157,7 @@ int main(int argc, char *argv[]) {
|
||||
else
|
||||
Sleep(2000);
|
||||
}
|
||||
|
||||
|
||||
//try to be semi-nice about this... without waiting too long
|
||||
zone = zones.begin();
|
||||
zend = zones.end();
|
||||
@@ -174,7 +174,7 @@ int main(int argc, char *argv[]) {
|
||||
for(; zone != zend; zone++) {
|
||||
delete zone->second;
|
||||
}
|
||||
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -35,7 +35,7 @@ WorldServer::~WorldServer() {
|
||||
|
||||
void WorldServer::OnConnected() {
|
||||
WorldConnection::OnConnected();
|
||||
|
||||
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_LauncherConnectInfo, sizeof(LauncherConnectInfo));
|
||||
LauncherConnectInfo* sci = (LauncherConnectInfo*) pack->pBuffer;
|
||||
strn0cpy(sci->name, m_name, sizeof(sci->name));
|
||||
@@ -43,7 +43,7 @@ void WorldServer::OnConnected() {
|
||||
// strcpy(sci->address, net.GetZoneAddress());
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
|
||||
|
||||
//send status for all zones...
|
||||
std::map<std::string, ZoneLaunch *>::iterator cur, end;
|
||||
cur = m_zones.begin();
|
||||
@@ -54,9 +54,9 @@ void WorldServer::OnConnected() {
|
||||
}
|
||||
|
||||
void WorldServer::Process() {
|
||||
|
||||
|
||||
WorldConnection::Process();
|
||||
|
||||
|
||||
if (!Connected())
|
||||
return;
|
||||
|
||||
@@ -83,8 +83,8 @@ void WorldServer::Process() {
|
||||
break;
|
||||
}
|
||||
const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer;
|
||||
|
||||
|
||||
|
||||
|
||||
switch(ZoneRequestCommands(lzr->command)) {
|
||||
case ZR_Start: {
|
||||
if(m_zones.find(lzr->short_name) != m_zones.end()) {
|
||||
@@ -123,7 +123,7 @@ void WorldServer::Process() {
|
||||
//ignore this, world is still being dumb
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default: {
|
||||
_log(LAUNCHER__NET, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size);
|
||||
break;
|
||||
@@ -138,11 +138,11 @@ void WorldServer::Process() {
|
||||
void WorldServer::SendStatus(const char *short_name, uint32 start_count, bool running) {
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneStatus, sizeof(LauncherZoneStatus));
|
||||
LauncherZoneStatus* it =(LauncherZoneStatus*) pack->pBuffer;
|
||||
|
||||
|
||||
strn0cpy(it->short_name, short_name, 32);
|
||||
it->start_count = start_count;
|
||||
it->running = running?1:0;
|
||||
|
||||
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ public:
|
||||
virtual ~WorldServer();
|
||||
|
||||
virtual void Process();
|
||||
|
||||
|
||||
void SendStatus(const char *short_name, uint32 start_count, bool running);
|
||||
|
||||
|
||||
private:
|
||||
virtual void OnConnected();
|
||||
|
||||
|
||||
const char *const m_name;
|
||||
const EQEmuConfig *const m_config;
|
||||
std::map<std::string, ZoneLaunch *> &m_zones;
|
||||
|
||||
Reference in New Issue
Block a user