X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusermanager.cpp;h=b3ee21f2bb7b8a34686acf9ac0e030175643c6ee;hb=b200104cf2c61465acecaca111e3ec727fc3b954;hp=fe052fcfc90f517c477772e8849f8aa15b8acb37;hpb=da29af8cba49d51e53d6e68237ccbf6370b6dd1f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/usermanager.cpp b/src/usermanager.cpp index fe052fcfc..b3ee21f2b 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -71,26 +71,38 @@ 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 - if (via->iohookprov) - via->iohookprov->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) + continue; + + iohookprovref->OnAccept(eh, client, server); + // IOHook could have encountered a fatal error, e.g. if the TLS ClientHello was already in the queue and there was no common TLS version + if (!eh->getError().empty()) + { + QuitUser(New, eh->getError()); + return; + } + } + if (this->local_users.size() > ServerInstance->Config->SoftLimit) { ServerInstance->SNO->WriteToSnoMask('a', "Warning: softlimit value has been reached: %d clients", ServerInstance->Config->SoftLimit); @@ -150,12 +162,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.");