]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_spanningtree Log nick collisions more verbosely and in all cases
authorAttila Molnar <attilamolnar@hush.com>
Sat, 23 May 2015 13:10:42 +0000 (15:10 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Sat, 23 May 2015 13:10:42 +0000 (15:10 +0200)
src/modules/m_spanningtree/nick.cpp
src/modules/m_spanningtree/nickcollide.cpp
src/modules/m_spanningtree/uid.cpp
src/modules/m_spanningtree/utils.h

index 9496c2874015808afe94a4486553f26b22e6d4fc..1d853a2dfe1c98332801886a4c86a9fbe80395ec 100644 (file)
@@ -47,7 +47,7 @@ CmdResult CommandNick::HandleRemote(RemoteUser* user, std::vector<std::string>&
        {
                // 'x' is the already existing user using the same nick as params[0]
                // 'user' is the user trying to change nick to the in use nick
-               bool they_change = Utils->DoCollision(x, TreeServer::Get(user), newts, user->ident, user->GetIPString(), user->uuid);
+               bool they_change = Utils->DoCollision(x, TreeServer::Get(user), newts, user->ident, user->GetIPString(), user->uuid, "NICK");
                if (they_change)
                {
                        // Remote client lost, or both lost, rewrite this nick change as a change to uuid before
index 3401041aa3a43ac3d17c946759bece1950644df3..62e200921eb8f92699346b31d4b4f16080d06a76 100644 (file)
@@ -33,7 +33,7 @@
  * Sends SAVEs as appropriate and forces nick change of the user 'u' if our side loses or if both lose.
  * Does not change the nick of the user that is trying to claim the nick of 'u', i.e. the "remote" user.
  */
-bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remotets, const std::string& remoteident, const std::string& remoteip, const std::string& remoteuid)
+bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remotets, const std::string& remoteident, const std::string& remoteip, const std::string& remoteuid, const char* collidecmd)
 {
        // At this point we're sure that a collision happened, increment the counter regardless of who wins
        ServerInstance->stats.Collisions++;
@@ -86,6 +86,10 @@ bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remo
                }
        }
 
+       ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Nick collision on \"%s\" caused by %s: %s/%lu/%s@%s %d <-> %s/%lu/%s@%s %d", u->nick.c_str(), collidecmd,
+               u->uuid.c_str(), (unsigned long)localts, u->ident.c_str(), u->GetIPString().c_str(), bChangeLocal,
+               remoteuid.c_str(), (unsigned long)remotets, remoteident.c_str(), remoteip.c_str(), bChangeRemote);
+
        /*
         * Send SAVE and accept the losing client with its UID (as we know the SAVE will
         * not fail under any circumstances -- UIDs are netwide exclusive).
index 72361af382377ba9cea33357f7dd83b47b9a1fb2..a3b80457927b5aacd6bce3e416328d34f4a9e5c0 100644 (file)
@@ -59,9 +59,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st
        else if (collideswith)
        {
                // The user on this side is registered, handle the collision
-               bool they_change = Utils->DoCollision(collideswith, remoteserver, age_t, params[5], params[6], params[0]);
-               ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Collision on %s %d", params[2].c_str(), they_change);
-
+               bool they_change = Utils->DoCollision(collideswith, remoteserver, age_t, params[5], params[6], params[0], "UID");
                if (they_change)
                {
                        // The client being introduced needs to change nick to uuid, change the nick in the message before
index 5aa8e925ec743eac983a1337fbcb0e9e11a551d7..84637bf01da9d44304d0423b949ae775aab9686d 100644 (file)
@@ -135,7 +135,7 @@ class SpanningTreeUtilities : public classbase
 
        /** Handle nick collision
         */
-       bool DoCollision(User* u, TreeServer* server, time_t remotets, const std::string& remoteident, const std::string& remoteip, const std::string& remoteuid);
+       bool DoCollision(User* u, TreeServer* server, time_t remotets, const std::string& remoteident, const std::string& remoteip, const std::string& remoteuid, const char* collidecmd);
 
        /** Compile a list of servers which contain members of channel c
         */