mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-12 14:02:26 +00:00
Fix for launcher not actually sending static ports when set in the db
This commit is contained in:
parent
7909270527
commit
8dd362a101
@ -760,6 +760,7 @@ typedef enum {
|
|||||||
struct LauncherZoneRequest {
|
struct LauncherZoneRequest {
|
||||||
uint8 command;
|
uint8 command;
|
||||||
char short_name[33];
|
char short_name[33];
|
||||||
|
uint16 port;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LauncherZoneStatus {
|
struct LauncherZoneStatus {
|
||||||
|
|||||||
@ -102,8 +102,6 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
Log.Out(Logs::Detail, Logs::Launcher, "Starting main loop...");
|
Log.Out(Logs::Detail, Logs::Launcher, "Starting main loop...");
|
||||||
|
|
||||||
// zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1");
|
|
||||||
|
|
||||||
ProcLauncher *launch = ProcLauncher::get();
|
ProcLauncher *launch = ProcLauncher::get();
|
||||||
RunLoops = true;
|
RunLoops = true;
|
||||||
while(RunLoops) {
|
while(RunLoops) {
|
||||||
|
|||||||
@ -86,14 +86,13 @@ void WorldServer::Process() {
|
|||||||
}
|
}
|
||||||
const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer;
|
const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer;
|
||||||
|
|
||||||
|
|
||||||
switch(ZoneRequestCommands(lzr->command)) {
|
switch(ZoneRequestCommands(lzr->command)) {
|
||||||
case ZR_Start: {
|
case ZR_Start: {
|
||||||
if(m_zones.find(lzr->short_name) != m_zones.end()) {
|
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);
|
Log.Out(Logs::Detail, Logs::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name);
|
||||||
} else {
|
} else {
|
||||||
Log.Out(Logs::Detail, Logs::Launcher, "World told us to start zone %s.", lzr->short_name);
|
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;
|
m_zones[lzr->short_name] = l;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -34,10 +34,11 @@ void ZoneLaunch::InitStartTimer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name,
|
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_state(StateStartPending),
|
||||||
m_world(world),
|
m_world(world),
|
||||||
m_zone(zone_name),
|
m_zone(zone_name),
|
||||||
|
m_port(port),
|
||||||
m_launcherName(launcher_name),
|
m_launcherName(launcher_name),
|
||||||
m_config(config),
|
m_config(config),
|
||||||
m_timer(config->RestartWait),
|
m_timer(config->RestartWait),
|
||||||
@ -61,10 +62,14 @@ void ZoneLaunch::SendStatus() const {
|
|||||||
void ZoneLaunch::Start() {
|
void ZoneLaunch::Start() {
|
||||||
ProcLauncher::Spec *spec = new ProcLauncher::Spec();
|
ProcLauncher::Spec *spec = new ProcLauncher::Spec();
|
||||||
spec->program = m_config->ZoneExe;
|
spec->program = m_config->ZoneExe;
|
||||||
// if(m_zone.substr(0,7) == "dynamic")
|
|
||||||
// spec->args.push_back(".");
|
if(m_port) {
|
||||||
// else
|
std::string arg = m_zone + std::string(":") + std::to_string(m_port);
|
||||||
spec->args.push_back(m_zone);
|
spec->args.push_back(arg);
|
||||||
|
} else {
|
||||||
|
spec->args.push_back(m_zone);
|
||||||
|
}
|
||||||
|
|
||||||
spec->args.push_back(m_launcherName);
|
spec->args.push_back(m_launcherName);
|
||||||
spec->handler = this;
|
spec->handler = this;
|
||||||
spec->logFile = m_config->LogPrefix + m_zone + m_config->LogSuffix;
|
spec->logFile = m_config->LogPrefix + m_zone + m_config->LogSuffix;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ class EQEmuConfig;
|
|||||||
class ZoneLaunch : protected ProcLauncher::EventHandler {
|
class ZoneLaunch : protected ProcLauncher::EventHandler {
|
||||||
public:
|
public:
|
||||||
ZoneLaunch(WorldServer *world, const char *launcher_name,
|
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();
|
virtual ~ZoneLaunch();
|
||||||
|
|
||||||
void Stop(bool graceful = true);
|
void Stop(bool graceful = true);
|
||||||
@ -63,6 +63,7 @@ protected:
|
|||||||
const std::string m_zone;
|
const std::string m_zone;
|
||||||
const char *const m_launcherName;
|
const char *const m_launcherName;
|
||||||
const EQEmuConfig *const m_config;
|
const EQEmuConfig *const m_config;
|
||||||
|
const uint16 m_port;
|
||||||
|
|
||||||
Timer m_timer;
|
Timer m_timer;
|
||||||
ProcLauncher::ProcRef m_ref;
|
ProcLauncher::ProcRef m_ref;
|
||||||
|
|||||||
@ -60,7 +60,7 @@ bool LauncherLink::Process() {
|
|||||||
end = m_states.end();
|
end = m_states.end();
|
||||||
for(; cur != end; ++cur) {
|
for(; cur != end; ++cur) {
|
||||||
if(!cur->second.up) {
|
if(!cur->second.up) {
|
||||||
StartZone(cur->first.c_str());
|
StartZone(cur->first.c_str(), cur->second.port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_bootTimer.Disable();
|
m_bootTimer.Disable();
|
||||||
@ -184,14 +184,6 @@ bool LauncherLink::Process() {
|
|||||||
|
|
||||||
bool LauncherLink::ContainsZone(const char *short_name) const {
|
bool LauncherLink::ContainsZone(const char *short_name) const {
|
||||||
return(m_states.find(short_name) != m_states.end());
|
return(m_states.find(short_name) != m_states.end());
|
||||||
|
|
||||||
/*
|
|
||||||
* std::map<std::string, bool>::const_iterator cur, end;
|
|
||||||
cur = m_states.begin();
|
|
||||||
end = m_states.end();
|
|
||||||
for(; cur != end; cur++) {
|
|
||||||
if(
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherLink::BootZone(const char *short_name, uint16 port) {
|
void LauncherLink::BootZone(const char *short_name, uint16 port) {
|
||||||
@ -202,15 +194,20 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) {
|
|||||||
Log.Out(Logs::Detail, Logs::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port);
|
Log.Out(Logs::Detail, Logs::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port);
|
||||||
m_states[short_name] = zs;
|
m_states[short_name] = zs;
|
||||||
|
|
||||||
StartZone(short_name);
|
StartZone(short_name, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherLink::StartZone(const char *short_name) {
|
void LauncherLink::StartZone(const char *short_name) {
|
||||||
|
StartZone(short_name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LauncherLink::StartZone(const char *short_name, uint16 port) {
|
||||||
auto pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest));
|
auto pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest));
|
||||||
LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer;
|
LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer;
|
||||||
|
|
||||||
strn0cpy(s->short_name, short_name, 32);
|
strn0cpy(s->short_name, short_name, 32);
|
||||||
s->command = ZR_Start;
|
s->command = ZR_Start;
|
||||||
|
s->port = port;
|
||||||
|
|
||||||
SendPacket(pack);
|
SendPacket(pack);
|
||||||
delete pack;
|
delete pack;
|
||||||
@ -222,6 +219,7 @@ void LauncherLink::RestartZone(const char *short_name) {
|
|||||||
|
|
||||||
strn0cpy(s->short_name, short_name, 32);
|
strn0cpy(s->short_name, short_name, 32);
|
||||||
s->command = ZR_Restart;
|
s->command = ZR_Restart;
|
||||||
|
s->port = 0;
|
||||||
|
|
||||||
SendPacket(pack);
|
SendPacket(pack);
|
||||||
delete pack;
|
delete pack;
|
||||||
@ -233,6 +231,7 @@ void LauncherLink::StopZone(const char *short_name) {
|
|||||||
|
|
||||||
strn0cpy(s->short_name, short_name, 32);
|
strn0cpy(s->short_name, short_name, 32);
|
||||||
s->command = ZR_Stop;
|
s->command = ZR_Stop;
|
||||||
|
s->port = 0;
|
||||||
|
|
||||||
SendPacket(pack);
|
SendPacket(pack);
|
||||||
delete pack;
|
delete pack;
|
||||||
@ -332,35 +331,3 @@ void LauncherLink::Shutdown() {
|
|||||||
SendPacket(pack);
|
SendPacket(pack);
|
||||||
delete pack;
|
delete pack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@ public:
|
|||||||
void Shutdown();
|
void Shutdown();
|
||||||
void BootZone(const char *short_name, uint16 port);
|
void BootZone(const char *short_name, uint16 port);
|
||||||
void StartZone(const char *short_name);
|
void StartZone(const char *short_name);
|
||||||
|
void StartZone(const char *short_name, uint16 port);
|
||||||
void RestartZone(const char *short_name);
|
void RestartZone(const char *short_name);
|
||||||
void StopZone(const char *short_name);
|
void StopZone(const char *short_name);
|
||||||
void BootDynamics(uint8 new_total);
|
void BootDynamics(uint8 new_total);
|
||||||
|
|||||||
88
zone/net.cpp
88
zone/net.cpp
@ -28,7 +28,6 @@
|
|||||||
#include "../common/eq_packet_structs.h"
|
#include "../common/eq_packet_structs.h"
|
||||||
#include "../common/mutex.h"
|
#include "../common/mutex.h"
|
||||||
#include "../common/version.h"
|
#include "../common/version.h"
|
||||||
|
|
||||||
#include "../common/packet_dump_file.h"
|
#include "../common/packet_dump_file.h"
|
||||||
#include "../common/opcodemgr.h"
|
#include "../common/opcodemgr.h"
|
||||||
#include "../common/guilds.h"
|
#include "../common/guilds.h"
|
||||||
@ -57,17 +56,14 @@
|
|||||||
#include "titles.h"
|
#include "titles.h"
|
||||||
#include "guild_mgr.h"
|
#include "guild_mgr.h"
|
||||||
#include "tasks.h"
|
#include "tasks.h"
|
||||||
|
|
||||||
#include "quest_parser_collection.h"
|
#include "quest_parser_collection.h"
|
||||||
#include "embparser.h"
|
#include "embparser.h"
|
||||||
#include "lua_parser.h"
|
#include "lua_parser.h"
|
||||||
|
|
||||||
#include "questmgr.h"
|
#include "questmgr.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -116,28 +112,77 @@ int main(int argc, char** argv) {
|
|||||||
RegisterExecutablePlatform(ExePlatformZone);
|
RegisterExecutablePlatform(ExePlatformZone);
|
||||||
Log.LoadLogSettingsDefaults();
|
Log.LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
const char *zone_name;
|
|
||||||
QServ = new QueryServ;
|
QServ = new QueryServ;
|
||||||
|
|
||||||
if(argc == 3) {
|
Log.Out(Logs::General, Logs::Zone_Server, "Loading server configuration..");
|
||||||
|
if(!ZoneConfig::LoadConfig()) {
|
||||||
|
Log.Out(Logs::General, Logs::Error, "Loading server configuration failed.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
const ZoneConfig *Config = ZoneConfig::get();
|
||||||
|
|
||||||
|
const char *zone_name;
|
||||||
|
uint32 instance_id = 0;
|
||||||
|
std::string z_name;
|
||||||
|
if(argc == 4) {
|
||||||
|
instance_id = atoi(argv[3]);
|
||||||
worldserver.SetLauncherName(argv[2]);
|
worldserver.SetLauncherName(argv[2]);
|
||||||
worldserver.SetLaunchedName(argv[1]);
|
auto zone_port = SplitString(argv[1], ':');
|
||||||
if(strncmp(argv[1], "dynamic_", 8) == 0) {
|
|
||||||
//dynamic zone with a launcher name correlation
|
if(zone_port.size() > 0) {
|
||||||
|
z_name = zone_port[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(zone_port.size() > 1) {
|
||||||
|
std::string p_name = zone_port[1];
|
||||||
|
Config->SetZonePort(atoi(p_name.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
worldserver.SetLaunchedName(z_name.c_str());
|
||||||
|
if(strncmp(z_name.c_str(), "dynamic_", 8) == 0) {
|
||||||
|
zone_name = ".";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
zone_name = z_name.c_str();
|
||||||
|
}
|
||||||
|
} else if(argc == 3) {
|
||||||
|
worldserver.SetLauncherName(argv[2]);
|
||||||
|
auto zone_port = SplitString(argv[1], ':');
|
||||||
|
|
||||||
|
if(zone_port.size() > 0) {
|
||||||
|
z_name = zone_port[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(zone_port.size() > 1) {
|
||||||
|
std::string p_name = zone_port[1];
|
||||||
|
Config->SetZonePort(atoi(p_name.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
worldserver.SetLaunchedName(z_name.c_str());
|
||||||
|
if(strncmp(z_name.c_str(), "dynamic_", 8) == 0) {
|
||||||
zone_name = ".";
|
zone_name = ".";
|
||||||
} else {
|
} else {
|
||||||
zone_name = argv[1];
|
zone_name = z_name.c_str();
|
||||||
worldserver.SetLaunchedName(zone_name);
|
|
||||||
}
|
}
|
||||||
} else if (argc == 2) {
|
} else if (argc == 2) {
|
||||||
worldserver.SetLauncherName("NONE");
|
worldserver.SetLauncherName("NONE");
|
||||||
worldserver.SetLaunchedName(argv[1]);
|
auto zone_port = SplitString(argv[1], ':');
|
||||||
if(strncmp(argv[1], "dynamic_", 8) == 0) {
|
|
||||||
//dynamic zone with a launcher name correlation
|
if(zone_port.size() > 0) {
|
||||||
|
z_name = zone_port[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(zone_port.size() > 1) {
|
||||||
|
std::string p_name = zone_port[1];
|
||||||
|
Config->SetZonePort(atoi(p_name.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
worldserver.SetLaunchedName(z_name.c_str());
|
||||||
|
if(strncmp(z_name.c_str(), "dynamic_", 8) == 0) {
|
||||||
zone_name = ".";
|
zone_name = ".";
|
||||||
} else {
|
}
|
||||||
zone_name = argv[1];
|
else {
|
||||||
worldserver.SetLaunchedName(zone_name);
|
zone_name = z_name.c_str();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
zone_name = ".";
|
zone_name = ".";
|
||||||
@ -145,13 +190,6 @@ int main(int argc, char** argv) {
|
|||||||
worldserver.SetLauncherName("NONE");
|
worldserver.SetLauncherName("NONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Out(Logs::General, Logs::Zone_Server, "Loading server configuration..");
|
|
||||||
if (!ZoneConfig::LoadConfig()) {
|
|
||||||
Log.Out(Logs::General, Logs::Error, "Loading server configuration failed.");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
const ZoneConfig *Config = ZoneConfig::get();
|
|
||||||
|
|
||||||
worldserver.SetPassword(Config->SharedKey.c_str());
|
worldserver.SetPassword(Config->SharedKey.c_str());
|
||||||
|
|
||||||
Log.Out(Logs::General, Logs::Zone_Server, "Connecting to MySQL...");
|
Log.Out(Logs::General, Logs::Zone_Server, "Connecting to MySQL...");
|
||||||
@ -312,7 +350,7 @@ int main(int argc, char** argv) {
|
|||||||
#endif
|
#endif
|
||||||
if (!strlen(zone_name) || !strcmp(zone_name,".")) {
|
if (!strlen(zone_name) || !strcmp(zone_name,".")) {
|
||||||
Log.Out(Logs::General, Logs::Zone_Server, "Entering sleep mode");
|
Log.Out(Logs::General, Logs::Zone_Server, "Entering sleep mode");
|
||||||
} else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance
|
} else if (!Zone::Bootup(database.GetZoneID(zone_name), instance_id, true)) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup");
|
Log.Out(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup");
|
||||||
zone = 0;
|
zone = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user