mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-24 05:18:40 +00:00
Some changes to the tasks service and the general routing strategy
This commit is contained in:
@@ -72,12 +72,6 @@ void LauncherLink::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
||||
ServerPacket *pack = &tpack;
|
||||
|
||||
switch (opcode) {
|
||||
case 0:
|
||||
break;
|
||||
case ServerOP_KeepAlive: {
|
||||
// ignore this
|
||||
break;
|
||||
}
|
||||
case ServerOP_ZAAuth: {
|
||||
Log(Logs::Detail, Logs::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str());
|
||||
break;
|
||||
@@ -296,4 +290,4 @@ void LauncherLink::Shutdown() {
|
||||
auto pack = new ServerPacket(ServerOP_ShutdownAll);
|
||||
SendPacket(pack);
|
||||
delete pack;
|
||||
}
|
||||
}
|
||||
|
||||
+46
-11
@@ -11,7 +11,7 @@ Router::~Router()
|
||||
void Router::AddConnection(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection)
|
||||
{
|
||||
m_connections.push_back(connection);
|
||||
connection->OnMessage(ServerOP_RouteTo, std::bind(&Router::OnRouterMessage, this, std::placeholders::_1, std::placeholders::_2));
|
||||
connection->OnMessage(ServerOP_RouteTo, std::bind(&Router::OnRouterMessage, this, connection, std::placeholders::_1, std::placeholders::_2));
|
||||
}
|
||||
|
||||
void Router::RemoveConnection(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection)
|
||||
@@ -27,19 +27,54 @@ void Router::RemoveConnection(std::shared_ptr<EQ::Net::ServertalkServerConnectio
|
||||
}
|
||||
}
|
||||
|
||||
void Router::OnRouterMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
void Router::OnRouterMessage(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection, uint16 opcode, const EQ::Net::Packet &p)
|
||||
{
|
||||
auto idx = 0;
|
||||
auto filter_length = p.GetInt32(idx); idx += sizeof(int32_t);
|
||||
auto filter = p.GetString(idx, filter_length); idx += filter_length;
|
||||
auto msg = p.GetSerialize<RouteToMessage>(0);
|
||||
auto payload_offset = p.Length() - msg.payload_size;
|
||||
auto payload = p.GetPacket(payload_offset, msg.payload_size);
|
||||
|
||||
printf("Recv router msg of size %i\n", p.Length());
|
||||
auto out_msg = msg;
|
||||
out_msg.identifier = connection->GetIdentifier();
|
||||
out_msg.id = connection->GetUUID();
|
||||
|
||||
for (auto &connection : m_connections) {
|
||||
auto identifier = connection->GetIdentifier();
|
||||
auto pos = identifier.find(filter);
|
||||
if (pos == 0) {
|
||||
connection->Send(opcode, p);
|
||||
EQ::Net::DynamicPacket out;
|
||||
out.PutSerialize(0, out_msg);
|
||||
out.PutPacket(out.Length(), payload);
|
||||
|
||||
if (!msg.id.empty() && !msg.filter.empty()) {
|
||||
for (auto &connection : m_connections) {
|
||||
auto id = connection->GetUUID();
|
||||
if (id == msg.id) {
|
||||
connection->Send(ServerOP_RouteTo, out);
|
||||
}
|
||||
else {
|
||||
auto identifier = connection->GetIdentifier();
|
||||
auto pos = identifier.find(msg.filter);
|
||||
if (pos == 0) {
|
||||
connection->Send(ServerOP_RouteTo, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!msg.id.empty()) {
|
||||
for (auto &connection : m_connections) {
|
||||
auto id = connection->GetUUID();
|
||||
if (id == msg.id) {
|
||||
connection->Send(ServerOP_RouteTo, out);
|
||||
}
|
||||
}
|
||||
} else if (!msg.filter.empty()) {
|
||||
for (auto &connection : m_connections) {
|
||||
auto identifier = connection->GetIdentifier();
|
||||
auto pos = identifier.find(msg.filter);
|
||||
if (pos == 0) {
|
||||
connection->Send(ServerOP_RouteTo, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (auto &connection : m_connections) {
|
||||
connection->Send(ServerOP_RouteTo, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,5 +15,5 @@ public:
|
||||
private:
|
||||
std::list<std::shared_ptr<EQ::Net::ServertalkServerConnection>> m_connections;
|
||||
|
||||
void OnRouterMessage(uint16 opcode, const EQ::Net::Packet &p);
|
||||
void OnRouterMessage(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection, uint16 opcode, const EQ::Net::Packet &p);
|
||||
};
|
||||
|
||||
@@ -36,14 +36,6 @@ void UCSConnection::ProcessPacket(uint16 opcode, EQ::Net::Packet &p)
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case ServerOP_KeepAlive:
|
||||
{
|
||||
// ignore this
|
||||
break;
|
||||
}
|
||||
case ServerOP_ZAAuth:
|
||||
{
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Got authentication from UCS when they are already authenticated.");
|
||||
|
||||
@@ -43,7 +43,6 @@ ZSList::ZSList()
|
||||
memset(pLockedZones, 0, sizeof(pLockedZones));
|
||||
|
||||
m_tick.reset(new EQ::Timer(5000, true, std::bind(&ZSList::OnTick, this, std::placeholders::_1)));
|
||||
m_keepalive.reset(new EQ::Timer(2500, true, std::bind(&ZSList::OnKeepAlive, this, std::placeholders::_1)));
|
||||
}
|
||||
|
||||
ZSList::~ZSList() {
|
||||
@@ -748,9 +747,3 @@ void ZSList::OnTick(EQ::Timer *t)
|
||||
web_interface.SendEvent(out);
|
||||
}
|
||||
|
||||
void ZSList::OnKeepAlive(EQ::Timer *t)
|
||||
{
|
||||
for (auto &zone : list) {
|
||||
zone->SendKeepAlive();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ public:
|
||||
|
||||
private:
|
||||
void OnTick(EQ::Timer *t);
|
||||
void OnKeepAlive(EQ::Timer *t);
|
||||
uint32 NextID;
|
||||
std::list<std::unique_ptr<ZoneServer>> list;
|
||||
uint16 pLockedZones[MaxLockedZones];
|
||||
|
||||
@@ -188,12 +188,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
ServerPacket *pack = &tpack;
|
||||
|
||||
switch (opcode) {
|
||||
case 0:
|
||||
break;
|
||||
case ServerOP_KeepAlive: {
|
||||
// ignore this
|
||||
break;
|
||||
}
|
||||
case ServerOP_ZAAuth: {
|
||||
break;
|
||||
}
|
||||
@@ -1417,13 +1411,6 @@ void ZoneServer::SendGroupIDs() {
|
||||
delete pack;
|
||||
}
|
||||
|
||||
|
||||
void ZoneServer::SendKeepAlive()
|
||||
{
|
||||
ServerPacket pack(ServerOP_KeepAlive, 0);
|
||||
SendPacket(&pack);
|
||||
}
|
||||
|
||||
void ZoneServer::ChangeWID(uint32 iCharID, uint32 iWID) {
|
||||
auto pack = new ServerPacket(ServerOP_ChangeWID, sizeof(ServerChangeWID_Struct));
|
||||
ServerChangeWID_Struct* scw = (ServerChangeWID_Struct*)pack->pBuffer;
|
||||
|
||||
@@ -39,7 +39,6 @@ public:
|
||||
void SendPacket(ServerPacket* pack) { tcpc->SendPacket(pack); }
|
||||
void SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message, ...);
|
||||
void SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message);
|
||||
void SendKeepAlive();
|
||||
bool SetZone(uint32 iZoneID, uint32 iInstanceID = 0, bool iStaticZone = false);
|
||||
void TriggerBootup(uint32 iZoneID = 0, uint32 iInstanceID = 0, const char* iAdminName = 0, bool iMakeStatic = false);
|
||||
void Disconnect() { auto handle = tcpc->Handle(); if (handle) { handle->Disconnect(); } }
|
||||
|
||||
Reference in New Issue
Block a user