mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
feat(master): login stamps travel through master and back
The login's Stamps now go with auth's REQUEST_ZONE_TRANSFER to master and come back in REQUEST_ZONE_TRANSFER_RESPONSE, so master stamps the steps it performs itself, with its own time: got the request (WORLD_PACKET_RECEIVED, zone), the world is still starting and the request waits (IM_LOGIN_QUEUED, instance), answered with a world (WORLD_SESSION_CONFIRM_TO_AUTH, instance). Auth sends what comes back in the login response. Server to server wire change (message IDs unchanged): both messages end with a Stamps list (u32 16 * count + 4, then the stamps); it is empty (4 bytes) when a world server asks for a transfer. Touched: - MasterPackets::SendZoneTransferRequest / SendZoneTransferResponse: take and write the stamps (default empty) - MasterServer.cpp REQUEST_ZONE_TRANSFER: reads them, stamps, keeps them in the PendingInstanceRequest (new stamps member, InstanceManager.h) - InstanceManager::ReadyInstance / AffirmTransfer: stamp and send them back - ZoneInstanceManager: HandleRequestZoneTransferResponse reads them; a RequestZoneTransfer overload takes stamps and a callback that gets them - AuthPackets LoginRequest::Handle uses that overload Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -156,6 +156,8 @@ void InstanceManager::ReadyInstance(const InstancePtr& instance) {
|
||||
|
||||
LOG("Responding to pending request %llu -> %i (%i)", request, zoneId.GetMapID(), zoneId.GetCloneID());
|
||||
|
||||
auto stamps = request.stamps;
|
||||
stamps.Add(eStamps::PASSPORT_AUTH_WORLD_SESSION_CONFIRM_TO_AUTH, zoneId.GetInstanceID());
|
||||
MasterPackets::SendZoneTransferResponse(
|
||||
Game::server,
|
||||
request.sysAddr,
|
||||
@@ -165,7 +167,8 @@ void InstanceManager::ReadyInstance(const InstancePtr& instance) {
|
||||
zoneId.GetInstanceID(),
|
||||
zoneId.GetCloneID(),
|
||||
instance->GetIP(),
|
||||
instance->GetPort()
|
||||
instance->GetPort(),
|
||||
stamps
|
||||
);
|
||||
}
|
||||
|
||||
@@ -199,6 +202,8 @@ void InstanceManager::AffirmTransfer(const InstancePtr& instance, const uint64_t
|
||||
|
||||
const auto& zoneId = instance->GetZoneID();
|
||||
|
||||
auto stamps = request.stamps;
|
||||
stamps.Add(eStamps::PASSPORT_AUTH_WORLD_SESSION_CONFIRM_TO_AUTH, zoneId.GetInstanceID());
|
||||
MasterPackets::SendZoneTransferResponse(
|
||||
Game::server,
|
||||
request.sysAddr,
|
||||
@@ -208,7 +213,8 @@ void InstanceManager::AffirmTransfer(const InstancePtr& instance, const uint64_t
|
||||
zoneId.GetInstanceID(),
|
||||
zoneId.GetCloneID(),
|
||||
instance->GetIP(),
|
||||
instance->GetPort()
|
||||
instance->GetPort(),
|
||||
stamps
|
||||
);
|
||||
|
||||
pending.erase(pending.begin() + i);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "dCommonVars.h"
|
||||
#include "IServerOperations.h"
|
||||
#include "RakNetTypes.h"
|
||||
#include "Stamps.h"
|
||||
#include "dZMCommon.h"
|
||||
#include "Logger.h"
|
||||
|
||||
@@ -18,6 +19,7 @@ struct PendingInstanceRequest {
|
||||
uint64_t id;
|
||||
bool mythranShift;
|
||||
SystemAddress sysAddr;
|
||||
Stamps stamps; // The login stamps that came with the request; they go back in the response
|
||||
};
|
||||
|
||||
class Instance {
|
||||
|
||||
@@ -640,6 +640,10 @@ void HandlePacket(Packet* packet) {
|
||||
inStream.Read(mythranShift);
|
||||
inStream.Read(zoneID);
|
||||
inStream.Read(zoneClone);
|
||||
// The login stamps travelling with the request (see Stamps.h); master adds its steps
|
||||
Stamps stamps;
|
||||
if (!stamps.Deserialize(inStream)) stamps = {};
|
||||
if (!stamps.empty()) stamps.Add(eStamps::PASSPORT_AUTH_WORLD_PACKET_RECEIVED, zoneID);
|
||||
if (shutdownSequenceStarted) {
|
||||
LOG("Shutdown sequence has been started. Not creating a new zone.");
|
||||
break;
|
||||
@@ -652,14 +656,15 @@ void HandlePacket(Packet* packet) {
|
||||
|
||||
if (in && !in->GetIsReady()) //Instance not ready, make a pending request
|
||||
{
|
||||
in->GetPendingRequests().push_back({ requestID, static_cast<bool>(mythranShift), packet->systemAddress });
|
||||
if (!stamps.empty()) stamps.Add(eStamps::PASSPORT_AUTH_IM_LOGIN_QUEUED, in->GetInstanceID());
|
||||
in->GetPendingRequests().push_back({ requestID, static_cast<bool>(mythranShift), packet->systemAddress, stamps });
|
||||
LOG("Server not ready, adding pending request %llu %i %i", requestID, zoneID, zoneClone);
|
||||
break;
|
||||
}
|
||||
|
||||
//Instance is ready, transfer
|
||||
LOG("Responding to transfer request %llu for zone %i %i", requestID, zoneID, zoneClone);
|
||||
Game::im->RequestAffirmation(in, { requestID, static_cast<bool>(mythranShift), packet->systemAddress });
|
||||
Game::im->RequestAffirmation(in, { requestID, static_cast<bool>(mythranShift), packet->systemAddress, stamps });
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user