]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/usermanager.cpp
Call IOHookProviders after the socket has been added to the SocketEngine in UserManag...
[user/henk/code/inspircd.git] / src / usermanager.cpp
index 95deca00a9a356f01a301bc9b135f485d2084a83..15c86157bff3784053fcbb596b9d3adefb909819 100644 (file)
@@ -71,30 +71,30 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
        LocalUser* const New = new LocalUser(socket, client, server);
        UserIOHandler* eh = &New->eh;
 
-       // If this listener has an IO hook provider set then tell it about the connection
-       for (ListenSocket::IOHookProvList::iterator i = via->iohookprovs.begin(); i != via->iohookprovs.end(); ++i)
-       {
-               ListenSocket::IOHookProvRef& iohookprovref = *i;
-               if (iohookprovref)
-                       iohookprovref->OnAccept(eh, client, server);
-       }
-
        ServerInstance->Logs->Log("USERS", LOG_DEBUG, "New user fd: %d", socket);
 
        this->unregistered_count++;
 
-       /* The users default nick is their UUID */
-       New->nick = New->uuid;
        this->clientlist[New->nick] = New;
-
-       New->registered = REG_NONE;
-       New->signon = ServerInstance->Time();
-       New->lastping = 1;
-
        this->AddClone(New);
 
        this->local_users.push_front(New);
 
+       if (!SocketEngine::AddFd(eh, FD_WANT_FAST_READ | FD_WANT_EDGE_WRITE))
+       {
+               ServerInstance->Logs->Log("USERS", LOG_DEBUG, "Internal error on new connection");
+               this->QuitUser(New, "Internal error handling connection");
+               return;
+       }
+
+       // If this listener has an IO hook provider set then tell it about the connection
+       for (ListenSocket::IOHookProvList::iterator i = via->iohookprovs.begin(); i != via->iohookprovs.end(); ++i)
+       {
+               ListenSocket::IOHookProvRef& iohookprovref = *i;
+               if (iohookprovref)
+                       iohookprovref->OnAccept(eh, client, server);
+       }
+
        if (this->local_users.size() > ServerInstance->Config->SoftLimit)
        {
                ServerInstance->SNO->WriteToSnoMask('a', "Warning: softlimit value has been reached: %d clients", ServerInstance->Config->SoftLimit);
@@ -154,12 +154,6 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
                }
        }
 
-       if (!SocketEngine::AddFd(eh, FD_WANT_FAST_READ | FD_WANT_EDGE_WRITE))
-       {
-               ServerInstance->Logs->Log("USERS", LOG_DEBUG, "Internal error on new connection");
-               this->QuitUser(New, "Internal error handling connection");
-       }
-
        if (ServerInstance->Config->RawLog)
                New->WriteNotice("*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded.");