diff options
| author | 2014-04-16 13:08:44 +0200 | |
|---|---|---|
| committer | 2014-04-16 13:08:44 +0200 | |
| commit | 3eb205218a321e454d873ae14e2e717ce9d64142 (patch) | |
| tree | 4f0c4aabf7fe7c51b329e09b59984977869fd786 /src/modules/m_spanningtree/treesocket2.cpp | |
| parent | Remove WALLCHOPS and WALLVOICES ISUPPORT tokens (diff) | |
m_spanningtree Throw an exception on protocol violations instead of returning CMD_INVALID
Catch CoreExceptions, log and close the link in OnDataReady()
Diffstat (limited to 'src/modules/m_spanningtree/treesocket2.cpp')
| -rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 4639a237e..8d939d22a 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -313,21 +313,13 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, return; } - ServerInstance->Logs->Log(MODNAME, LOG_SPARSE, "Unrecognised S2S command :%s %s %s", - who->uuid.c_str(), command.c_str(), irc::stringjoiner(params).c_str()); - SendError("Unrecognised command '" + command + "' -- possibly loaded mismatched modules"); - return; + throw ProtocolException("Unknown command"); } cmdbase = cmd; } if (params.size() < cmdbase->min_params) - { - ServerInstance->Logs->Log(MODNAME, LOG_SPARSE, "Insufficient parameters for S2S command :%s %s %s", - who->uuid.c_str(), command.c_str(), irc::stringjoiner(params).c_str()); - SendError("Insufficient parameters for command '" + command + "'"); - return; - } + throw ProtocolException("Insufficient parameters"); if ((!params.empty()) && (params.back().empty()) && (!cmdbase->allow_empty_last_param)) { @@ -341,15 +333,13 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, if (scmd) res = scmd->Handle(who, params); else - res = cmd->Handle(params, who); - - if (res == CMD_INVALID) { - ServerInstance->Logs->Log(MODNAME, LOG_SPARSE, "Error handling S2S command :%s %s %s", - who->uuid.c_str(), command.c_str(), irc::stringjoiner(params).c_str()); - SendError("Error handling '" + command + "' -- possibly loaded mismatched modules"); + res = cmd->Handle(params, who); + if (res == CMD_INVALID) + throw ProtocolException("Error in command handler"); } - else if (res == CMD_SUCCESS) + + if (res == CMD_SUCCESS) Utils->RouteCommand(route_back_again, cmdbase, params, who); } |
