Moving RequestGetServerAddress into the Lobby Server.

This commit is contained in:
HikikoMarmy
2025-04-14 19:32:04 +01:00
parent da39da996e
commit 94753a7bd4
5 changed files with 12 additions and 102 deletions

View File

@@ -1,32 +0,0 @@
#include "../../global_define.h"
#include "GetServerAddressEvent.h"
void RequestGetServerAddress::Deserialize( sptr_byte_stream stream )
{
DeserializeHeader( stream );
}
sptr_generic_response RequestGetServerAddress::ProcessRequest( sptr_byte_stream stream )
{
Deserialize( stream);
return std::make_shared< ResultGetServerAddress >( this, Config::service_ip, Config::lobby_port );
}
ResultGetServerAddress::ResultGetServerAddress( GenericRequest *request, std::string ip, int32_t port ) : GenericResponse( *request )
{
m_ip = ip;
m_port = port;
}
ByteStream& ResultGetServerAddress::Serialize()
{
m_stream.write_u16( m_packetId );
m_stream.write_u32( m_requestId );
m_stream.write_u32( 0 );
m_stream.write_sz_utf8( m_ip );
m_stream.write( m_port );
return m_stream;
}

View File

@@ -1,20 +0,0 @@
#pragma once
class RequestGetServerAddress : public GenericRequest {
public:
static std::unique_ptr< RequestGetServerAddress > Create()
{
return std::make_unique< RequestGetServerAddress >();
}
sptr_generic_response ProcessRequest( sptr_byte_stream stream ) override;
void Deserialize( sptr_byte_stream stream ) override;
};
class ResultGetServerAddress : public GenericResponse {
public:
std::string m_ip;
int32_t m_port;
ResultGetServerAddress( GenericRequest *request, std::string ip, int32_t port );
ByteStream &Serialize();
};