From 3eb205218a321e454d873ae14e2e717ce9d64142 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 16 Apr 2014 13:08:44 +0200 Subject: m_spanningtree Throw an exception on protocol violations instead of returning CMD_INVALID Catch CoreExceptions, log and close the link in OnDataReady() --- src/modules/m_spanningtree/treesocket1.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/modules/m_spanningtree/treesocket1.cpp') diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 9da06e829..931bd3f9f 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -251,7 +251,18 @@ void TreeSocket::OnDataReady() SendError("Read null character from socket"); break; } - ProcessLine(line); + + try + { + ProcessLine(line); + } + catch (CoreException& ex) + { + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error while processing: " + line); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, ex.GetReason()); + SendError(ex.GetReason() + " - check the log file for details"); + } + if (!getError().empty()) break; } -- cgit v1.2.3