mirror of https://github.com/SeanOMik/libki.git
net: Implement send_message on DMLSession
This commit is contained in:
parent
1d6855581a
commit
59aa21b4b6
|
@ -9,6 +9,7 @@ namespace control
|
|||
{
|
||||
enum class Opcode : uint8_t
|
||||
{
|
||||
NONE = 0,
|
||||
SERVER_HELLO = 0,
|
||||
UDP_HELLO = 1,
|
||||
PING = 3,
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace net
|
|||
DMLSession(ParticipantType type, uint16_t id,
|
||||
const dml::MessageManager &manager);
|
||||
~DMLSession() = default;
|
||||
|
||||
void send_message(const dml::Message &message);
|
||||
protected:
|
||||
void on_application_message(const PacketHeader& header) override;
|
||||
virtual void on_message(const dml::Message &message) {}
|
||||
|
|
|
@ -10,6 +10,11 @@ namespace net
|
|||
const dml::MessageManager& manager)
|
||||
: Session(type, id), m_manager(manager) {}
|
||||
|
||||
void DMLSession::send_message(const dml::Message& message)
|
||||
{
|
||||
send_packet(false, control::Opcode::NONE, message);
|
||||
}
|
||||
|
||||
void DMLSession::on_application_message(const PacketHeader& header)
|
||||
{
|
||||
const auto *message = m_manager.message_from_binary(m_data_stream);
|
||||
|
|
Loading…
Reference in New Issue