diff options
Diffstat (limited to 'src/Protocol/ProtocolRecognizer.cpp')
-rw-r--r-- | src/Protocol/ProtocolRecognizer.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index 6ad0a095d..17b42dae9 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -1038,7 +1038,24 @@ bool cProtocolRecognizer::TryRecognizeProtocol(void) // Not enough bytes for the packet, keep waiting return false; } - return TryRecognizeLengthedProtocol(PacketLen - ReadSoFar); + if (!TryRecognizeLengthedProtocol(PacketLen - ReadSoFar)) + { + return false; + } + + // The protocol has been recognized, initialize it: + ASSERT(m_Protocol != nullptr); + try + { + m_Protocol->Initialize(*m_Client); + } + catch (const std::exception & exc) + { + m_Client->Kick(exc.what()); + m_Protocol.reset(); + return false; + } + return true; } |