X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusermanager.cpp;h=15196ac69972a7b139ad9d7c1d93766bc0ddc64d;hb=58895f9b1daa1e13927462d046a36dec853a40e0;hp=b9eff5a3991b21da78fecd74b6998055ba72be28;hpb=47c4da37d6b9c7f443ad871771558e01ffec791a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/usermanager.cpp b/src/usermanager.cpp index b9eff5a39..15196ac69 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -46,7 +46,7 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, ClientListenSocket* vi { try { - New->GetIOHook()->OnRawSocketAccept(socket, client, server); + New->GetIOHook()->OnStreamSocketAccept(New, client, server); } catch (CoreException& modexcept) { @@ -179,7 +179,7 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char user->quitting = true; - ServerInstance->Logs->Log("USERS", DEBUG, "QuitUser: %s '%s'", user->nick.c_str(), quitreason.c_str()); + ServerInstance->Logs->Log("USERS", DEBUG, "QuitUser: %s=%s '%s'", user->uuid.c_str(), user->nick.c_str(), quitreason.c_str()); user->Write("ERROR :Closing link: (%s@%s) [%s]", user->ident.c_str(), user->host.c_str(), *operreason ? operreason : quitreason.c_str()); std::string reason; @@ -201,24 +201,18 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char FOREACH_MOD_I(ServerInstance,I_OnUserDisconnect,OnUserDisconnect(user)); - user->UpdateNickHash(user->uuid.c_str()); - - user_hash::iterator iter = this->clientlist->find(user->uuid); - if (user->registered != REG_ALL) if (ServerInstance->Users->unregistered_count) ServerInstance->Users->unregistered_count--; if (IS_LOCAL(user)) { - if (!user->sendq.empty()) - user->FlushWriteBuf(); - + user->DoWrite(); if (user->GetIOHook()) { try { - user->GetIOHook()->OnRawSocketClose(user->GetFd()); + user->GetIOHook()->OnStreamSocketClose(user); } catch (CoreException& modexcept) { @@ -227,7 +221,9 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char } ServerInstance->SE->DelFd(user); - user->CloseSocket(); + user->Close(); + // user->Close() will set fd to -1; this breaks IS_LOCAL. Fix + user->SetFd(INT_MAX); } /* @@ -255,19 +251,12 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char user->AddToWhoWas(); } + user_hash::iterator iter = this->clientlist->find(user->nick); + if (iter != this->clientlist->end()) this->clientlist->erase(iter); else ServerInstance->Logs->Log("USERS", DEBUG, "iter == clientlist->end, can't remove them from hash... problematic.."); - - if (IS_LOCAL(user)) - { - std::vector::iterator x = find(local_users.begin(),local_users.end(),user); - if (x != local_users.end()) - local_users.erase(x); - else - ServerInstance->Logs->Log("USERS", DEBUG, "Failed to remove user from vector"); - } }