Merge conflicts

This commit is contained in:
KimLS
2013-05-15 13:22:46 -07:00
616 changed files with 38180 additions and 38954 deletions
+14 -14
View File
@@ -1,14 +1,14 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(eqlaunch_sources
eqlaunch.cpp
worldserver.cpp
ZoneLaunch.cpp
eqlaunch.cpp
worldserver.cpp
ZoneLaunch.cpp
)
SET(eqlaunch_headers
worldserver.h
ZoneLaunch.h
worldserver.h
ZoneLaunch.h
)
ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
@@ -16,24 +16,24 @@ 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")
SET_TARGET_PROPERTIES(eqlaunch PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(eqlaunch "Ws2_32.lib")
ENDIF(MSVC)
IF(MINGW)
TARGET_LINK_LIBRARIES(eqlaunch "WS2_32")
TARGET_LINK_LIBRARIES(eqlaunch "WS2_32")
ENDIF(MINGW)
IF(UNIX)
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(eqlaunch "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(eqlaunch "z")
TARGET_LINK_LIBRARIES(eqlaunch "m")
TARGET_LINK_LIBRARIES(eqlaunch "rt")
TARGET_LINK_LIBRARIES(eqlaunch "pthread")
ADD_DEFINITIONS(-fPIC)
TARGET_LINK_LIBRARIES(eqlaunch "z")
TARGET_LINK_LIBRARIES(eqlaunch "m")
TARGET_LINK_LIBRARIES(eqlaunch "rt")
TARGET_LINK_LIBRARIES(eqlaunch "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
+33 -68
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
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,17 +33,17 @@ void ZoneLaunch::InitStartTimer() {
s_startTimer.Trigger();
}
ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name,
const char *zone_name, const EQEmuConfig *config)
ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name,
const char *zone_name, const EQEmuConfig *config)
: m_state(StateStartPending),
m_world(world),
m_zone(zone_name),
m_launcherName(launcher_name),
m_config(config),
m_timer(config->RestartWait),
m_ref(ProcLauncher::ProcError),
m_startCount(0),
m_killFails(0)
m_world(world),
m_zone(zone_name),
m_launcherName(launcher_name),
m_config(config),
m_timer(config->RestartWait),
m_ref(ProcLauncher::ProcError),
m_startCount(0),
m_killFails(0)
{
//trigger the startup timer initially so it boots the first time.
m_timer.Trigger();
@@ -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,42 +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();
}
+26 -35
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
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
*/
#ifndef ZONELAUNCH_H_
#define ZONELAUNCH_H_
@@ -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,30 +58,21 @@ 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;
};
#endif /*ZONELAUNCH_H_*/
+47 -47
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
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
*/
#include "../common/debug.h"
@@ -37,8 +37,8 @@ bool RunLoops = false;
void CatchSignal(int sig_num);
int main(int argc, char *argv[]) {
RegisterExecutablePlatform(ExePlatformLaunch);
set_exception_handler();
RegisterExecutablePlatform(ExePlatformLaunch);
set_exception_handler();
string launcher_name;
if(argc == 2) {
@@ -48,17 +48,17 @@ 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
*/
* Setup nice signal handlers
*/
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
_log(LAUNCHER__ERROR, "Could not set signal handler");
return 1;
@@ -72,10 +72,10 @@ int main(int argc, char *argv[]) {
_log(LAUNCHER__ERROR, "Could not set signal handler");
return 1;
}
/*
* Add '.' to LD_LIBRARY_PATH
*/
* Add '.' to LD_LIBRARY_PATH
*/
//the storage passed to putenv must remain valid... crazy unix people
const char *pv = getenv("LD_LIBRARY_PATH");
if(pv == nullptr) {
@@ -86,51 +86,51 @@ 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
*/
* Process the world connection
*/
world.Process();
/*
* Let the process manager look for dead children
*/
* Let the process manager look for dead children
*/
launch->Process();
/*
* Give all zones a chance to process.
*/
* Give all zones a chance to process.
*/
zone = zones.begin();
zend = zones.end();
for(; zone != zend; zone++) {
if(!zone->second->Process())
to_remove.insert(zone->first);
}
/*
* Kill off any zones which have stopped
*/
* Kill off any zones which have stopped
*/
while(!to_remove.empty()) {
string rem = *to_remove.begin();
to_remove.erase(rem);
@@ -142,22 +142,22 @@ 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
*/
* Take a nice nap until next cycle
*/
if(zones.empty())
Sleep(5000);
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);
}
+25 -25
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
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
*/
#include "../common/debug.h"
#include "worldserver.h"
@@ -24,9 +24,9 @@
WorldServer::WorldServer(map<string, ZoneLaunch *> &zones, const char *name, const EQEmuConfig *config)
: WorldConnection(EmuTCPConnection::packetModeLauncher, config->SharedKey.c_str()),
m_name(name),
m_config(config),
m_zones(zones)
m_name(name),
m_config(config),
m_zones(zones)
{
}
@@ -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);
}
+15 -15
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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 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
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.
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
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
*/
#ifndef WORLDSERVER_H
#define WORLDSERVER_H
@@ -29,15 +29,15 @@ class EQEmuConfig;
class WorldServer : public WorldConnection {
public:
WorldServer(std::map<std::string, ZoneLaunch *> &zones, const char *name, const EQEmuConfig *config);
virtual ~WorldServer();
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;