net: Implement send_message on DMLSession

This commit is contained in:
Joshua Scott 2018-04-11 01:18:31 +01:00
parent 1d6855581a
commit 59aa21b4b6
3 changed files with 8 additions and 0 deletions

View File

@ -9,6 +9,7 @@ namespace control
{
enum class Opcode : uint8_t
{
NONE = 0,
SERVER_HELLO = 0,
UDP_HELLO = 1,
PING = 3,

View File

@ -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) {}

View File

@ -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);