From 1927426034466397ba526dcfb1902f8a0ba9f183 Mon Sep 17 00:00:00 2001 From: Joshua Scott Date: Fri, 20 Apr 2018 01:35:43 +0100 Subject: [PATCH] net: Fix some observed problems It seems the client sends application messages before the session has been established. --- src/protocol/net/DMLSession.cpp | 6 +++++- src/protocol/net/Session.cpp | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/protocol/net/DMLSession.cpp b/src/protocol/net/DMLSession.cpp index a0e4b85..54fc9a4 100644 --- a/src/protocol/net/DMLSession.cpp +++ b/src/protocol/net/DMLSession.cpp @@ -23,7 +23,11 @@ namespace net return; } - on_message(*message); + // Are we sufficiently authenticated to handle this message? + if (get_access_level() >= message->get_access_level()) + on_message(*message); + else + on_invalid_message(); delete message; } } diff --git a/src/protocol/net/Session.cpp b/src/protocol/net/Session.cpp index f5467c3..6a995c8 100644 --- a/src/protocol/net/Session.cpp +++ b/src/protocol/net/Session.cpp @@ -182,10 +182,8 @@ namespace net // whether this is a control packet or not if (header.is_control()) on_control_message(header); - else if (m_established) - on_application_message(header); else - close(); + on_application_message(header); } } }