mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 17:38:26 +00:00
Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository
This commit is contained in:
+19
-22
@@ -39,7 +39,6 @@ ZSList::ZSList()
|
||||
{
|
||||
NextID = 1;
|
||||
CurGroupID = 1;
|
||||
LastAllocatedPort = 0;
|
||||
memset(pLockedZones, 0, sizeof(pLockedZones));
|
||||
|
||||
m_tick.reset(new EQ::Timer(5000, true, std::bind(&ZSList::OnTick, this, std::placeholders::_1)));
|
||||
@@ -76,7 +75,12 @@ void ZSList::Remove(const std::string &uuid)
|
||||
auto iter = zone_server_list.begin();
|
||||
while (iter != zone_server_list.end()) {
|
||||
if ((*iter)->GetUUID().compare(uuid) == 0) {
|
||||
auto port = (*iter)->GetCPort();
|
||||
zone_server_list.erase(iter);
|
||||
|
||||
if (port != 0) {
|
||||
m_ports_free.push_back(port);
|
||||
}
|
||||
return;
|
||||
}
|
||||
iter++;
|
||||
@@ -239,6 +243,14 @@ bool ZSList::SetLockedZone(uint16 iZoneID, bool iLock) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void ZSList::Init()
|
||||
{
|
||||
const WorldConfig* Config = WorldConfig::get();
|
||||
for (uint16 i = Config->ZonePortLow; i <= Config->ZonePortHigh; ++i) {
|
||||
m_ports_free.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
bool ZSList::IsZoneLocked(uint16 iZoneID) {
|
||||
for (auto &zone : pLockedZones) {
|
||||
if (zone == iZoneID)
|
||||
@@ -577,30 +589,15 @@ void ZSList::RebootZone(const char* ip1, uint16 port, const char* ip2, uint32 sk
|
||||
safe_delete_array(tmp);
|
||||
}
|
||||
|
||||
uint16 ZSList::GetAvailableZonePort()
|
||||
uint16 ZSList::GetAvailableZonePort()
|
||||
{
|
||||
const WorldConfig *Config = WorldConfig::get();
|
||||
int i;
|
||||
uint16 port = 0;
|
||||
|
||||
if (LastAllocatedPort == 0)
|
||||
i = Config->ZonePortLow;
|
||||
else
|
||||
i = LastAllocatedPort + 1;
|
||||
|
||||
while (i != LastAllocatedPort && port == 0) {
|
||||
if (i>Config->ZonePortHigh)
|
||||
i = Config->ZonePortLow;
|
||||
|
||||
if (!FindByPort(i)) {
|
||||
port = i;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
if (m_ports_free.empty()) {
|
||||
return 0;
|
||||
}
|
||||
LastAllocatedPort = port;
|
||||
|
||||
return port;
|
||||
auto first = m_ports_free.front();
|
||||
m_ports_free.pop_front();
|
||||
return first;
|
||||
}
|
||||
|
||||
uint32 ZSList::TriggerBootup(uint32 iZoneID, uint32 iInstanceID) {
|
||||
|
||||
Reference in New Issue
Block a user