Fix for launcher not actually sending static ports when set in the db

This commit is contained in:
KimLS
2015-07-11 13:28:09 -07:00
parent 7909270527
commit 8dd362a101
8 changed files with 87 additions and 77 deletions
-2
View File
@@ -102,8 +102,6 @@ int main(int argc, char *argv[]) {
Log.Out(Logs::Detail, Logs::Launcher, "Starting main loop...");
// zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1");
ProcLauncher *launch = ProcLauncher::get();
RunLoops = true;
while(RunLoops) {
+1 -2
View File
@@ -86,14 +86,13 @@ void WorldServer::Process() {
}
const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer;
switch(ZoneRequestCommands(lzr->command)) {
case ZR_Start: {
if(m_zones.find(lzr->short_name) != m_zones.end()) {
Log.Out(Logs::Detail, Logs::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name);
} else {
Log.Out(Logs::Detail, Logs::Launcher, "World told us to start zone %s.", lzr->short_name);
ZoneLaunch *l = new ZoneLaunch(this, m_name, lzr->short_name, m_config);
ZoneLaunch *l = new ZoneLaunch(this, m_name, lzr->short_name, lzr->port, m_config);
m_zones[lzr->short_name] = l;
}
break;
+10 -5
View File
@@ -34,10 +34,11 @@ void ZoneLaunch::InitStartTimer() {
}
ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name,
const char *zone_name, const EQEmuConfig *config)
const char *zone_name, uint16 port, const EQEmuConfig *config)
: m_state(StateStartPending),
m_world(world),
m_zone(zone_name),
m_port(port),
m_launcherName(launcher_name),
m_config(config),
m_timer(config->RestartWait),
@@ -61,10 +62,14 @@ void ZoneLaunch::SendStatus() const {
void ZoneLaunch::Start() {
ProcLauncher::Spec *spec = new ProcLauncher::Spec();
spec->program = m_config->ZoneExe;
// if(m_zone.substr(0,7) == "dynamic")
// spec->args.push_back(".");
// else
spec->args.push_back(m_zone);
if(m_port) {
std::string arg = m_zone + std::string(":") + std::to_string(m_port);
spec->args.push_back(arg);
} else {
spec->args.push_back(m_zone);
}
spec->args.push_back(m_launcherName);
spec->handler = this;
spec->logFile = m_config->LogPrefix + m_zone + m_config->LogSuffix;
+2 -1
View File
@@ -28,7 +28,7 @@ class EQEmuConfig;
class ZoneLaunch : protected ProcLauncher::EventHandler {
public:
ZoneLaunch(WorldServer *world, const char *launcher_name,
const char *zone_name, const EQEmuConfig *config);
const char *zone_name, uint16 port, const EQEmuConfig *config);
virtual ~ZoneLaunch();
void Stop(bool graceful = true);
@@ -63,6 +63,7 @@ protected:
const std::string m_zone;
const char *const m_launcherName;
const EQEmuConfig *const m_config;
const uint16 m_port;
Timer m_timer;
ProcLauncher::ProcRef m_ref;