mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53: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:
@@ -8,10 +8,16 @@ ZoneInstanceManager* ZoneInstanceManager::m_Address = nullptr;
|
||||
|
||||
//! Requests a zone transfer
|
||||
void ZoneInstanceManager::RequestZoneTransfer(dServer* server, uint32_t zoneID, uint32_t zoneClone, bool mythranShift, TransferCallback callback) {
|
||||
RequestZoneTransfer(server, zoneID, zoneClone, mythranShift, Stamps{}, [callback](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort, Stamps) {
|
||||
callback(mythranShift, zoneID, zoneInstance, zoneClone, serverIP, serverPort);
|
||||
});
|
||||
}
|
||||
|
||||
void ZoneInstanceManager::RequestZoneTransfer(dServer* server, uint32_t zoneID, uint32_t zoneClone, bool mythranShift, const Stamps& stamps, StampedTransferCallback callback) {
|
||||
const auto nextID = ++currentRequestID;
|
||||
requests[nextID] = callback;
|
||||
|
||||
MasterPackets::SendZoneTransferRequest(server, nextID, mythranShift, zoneID, zoneClone);
|
||||
MasterPackets::SendZoneTransferRequest(server, nextID, mythranShift, zoneID, zoneClone, stamps);
|
||||
}
|
||||
|
||||
//! Handles a zone transfer response
|
||||
@@ -33,10 +39,12 @@ void ZoneInstanceManager::HandleRequestZoneTransferResponse(Packet* packet) {
|
||||
inStream.Read(serverPort);
|
||||
LUString serverIP(255);
|
||||
inStream.Read(serverIP);
|
||||
Stamps stamps;
|
||||
if (!stamps.Deserialize(inStream)) stamps = {};
|
||||
|
||||
const auto entry = requests.find(requestID);
|
||||
if (entry != requests.end()) {
|
||||
entry->second(mythranShift, zoneID, zoneInstance, zoneClone, serverIP.string, serverPort);
|
||||
entry->second(mythranShift, zoneID, zoneInstance, zoneClone, serverIP.string, serverPort, stamps);
|
||||
requests.erase(entry);
|
||||
}
|
||||
}
|
||||
@@ -51,7 +59,9 @@ void ZoneInstanceManager::RequestPrivateZone(
|
||||
const std::string& password,
|
||||
TransferCallback callback) {
|
||||
const auto nextID = ++currentRequestID;
|
||||
requests[nextID] = callback;
|
||||
requests[nextID] = [callback](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort, Stamps) {
|
||||
callback(mythranShift, zoneID, zoneInstance, zoneClone, serverIP, serverPort);
|
||||
};
|
||||
|
||||
MasterPackets::SendZoneRequestPrivate(server, nextID, mythranShift, password);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user