summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp8
-rw-r--r--src/modules/m_spanningtree/utils.cpp7
2 files changed, 11 insertions, 4 deletions
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index dc9bb5331..3c838177d 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -218,7 +218,13 @@ CmdResult CommandSQuit::HandleServer(TreeServer* server, std::vector<std::string
TreeSocket* sock = server->GetSocket();
sock->Squit(quitting, params[1]);
- return CMD_SUCCESS;
+
+ // XXX: Return CMD_FAILURE when servers SQUIT themselves (i.e. :00S SQUIT 00S :Shutting down)
+ // to avoid RouteCommand() being called. RouteCommand() requires a valid command source but we
+ // do not have one because the server user is deleted when its TreeServer is destructed.
+ // We generate a SQUIT in TreeSocket::Squit(), with our sid as the source and send it to the
+ // remaining servers.
+ return ((quitting == server) ? CMD_FAILURE : CMD_SUCCESS);
}
/** This function is called when we receive data from a remote
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 0ec0a57f9..0372172f5 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -365,9 +365,10 @@ Link* SpanningTreeUtilities::FindLink(const std::string& name)
void SpanningTreeUtilities::SendChannelMessage(const std::string& prefix, Channel* target, const std::string& text, char status, const CUList& exempt_list, const char* message_type, TreeSocket* omit)
{
CmdBuilder msg(prefix, message_type);
- if (status == 0)
- status = ' ';
- msg.push(status).push_raw(target->name).push_last(text);
+ msg.push_raw(' ');
+ if (status != 0)
+ msg.push_raw(status);
+ msg.push_raw(target->name).push_last(text);
TreeSocketSet list;
this->GetListOfServersForChannel(target, list, status, exempt_list);