X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusermanager.cpp;h=12db0dde2fb406d0fa0a43efc86db79594372eb0;hb=9b17aecc0d711b1345416c0510adb270399960a9;hp=29d1f737003c88bf1c8576015a90ae69ae4e3eda;hpb=99f79a4e5c3abbe91a03216824e7659051872054;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 29d1f7370..12db0dde2 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -28,7 +28,7 @@ UserManager::UserManager() : clientlist(new user_hash) , uuidlist(new user_hash) - , unregistered_count(0), local_count(0) + , unregistered_count(0) { } @@ -81,10 +81,9 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs ServerInstance->Users->AddLocalClone(New); ServerInstance->Users->AddGlobalClone(New); - New->localuseriter = this->local_users.insert(local_users.end(), New); - local_count++; + this->local_users.push_front(New); - if ((this->local_users.size() > ServerInstance->Config->SoftLimit) || (this->local_users.size() >= (unsigned int)ServerInstance->SE->GetMaxFds())) + if ((this->local_users.size() > ServerInstance->Config->SoftLimit) || (this->local_users.size() >= (unsigned int)SocketEngine::GetMaxFds())) { ServerInstance->SNO->WriteToSnoMask('a', "Warning: softlimit value has been reached: %d clients", ServerInstance->Config->SoftLimit); this->QuitUser(New,"No more connections allowed"); @@ -142,7 +141,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs } } - if (!ServerInstance->SE->AddFd(eh, FD_WANT_FAST_READ | FD_WANT_EDGE_WRITE)) + 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"); @@ -210,6 +209,7 @@ void UserManager::QuitUser(User* user, const std::string& quitreason, const std: ServerInstance->Logs->Log("USERS", LOG_DEFAULT, "ERROR: Nick not found in clientlist, cannot remove: " + user->nick); uuidlist->erase(user->uuid); + user->PurgeEmptyChannels(); } void UserManager::AddLocalClone(User *user) @@ -337,7 +337,7 @@ void UserManager::DoBackgroundUserStuff() if (!curr->lastping) { time_t time = ServerInstance->Time() - (curr->nping - curr->MyClass->GetPingTime()); - const std::string message = "Ping timeout: " + ConvToStr(time) + (time == 1 ? " seconds" : " second"); + const std::string message = "Ping timeout: " + ConvToStr(time) + (time != 1 ? " seconds" : " second"); this->QuitUser(curr, message); continue; }