diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-21 13:26:31 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-21 13:26:31 +0000 |
commit | e2af2347fc035d702e45f12e772223a8d578410d (patch) | |
tree | bfd80aac2858a9f4faedc316794fc1051dbaa72c /src/usermanager.cpp | |
parent | 16fc672b685752007e47aed0fb97bc1ee7443c76 (diff) |
Create StreamSocket for IO hooking implementation
Fixes the SSL SendQ bug
Removes duplicate code between User and BufferedSocket
Simplify SSL module API
Simplify EventHandler API (Readable/Writeable moved to SE)
Add hook for culled objects to invoke callbacks prior to destructor
Replace SocketCull with GlobalCull now that sockets can close themselves
Shorten common case of user read/parse/write path:
User::Write is now zero-copy up to syscall/SSL invocation
User::Read has only two copy/scan passes from read() to ProcessCommand
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11752 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/usermanager.cpp')
-rw-r--r-- | src/usermanager.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/src/usermanager.cpp b/src/usermanager.cpp index b9eff5a39..6d04bdff7 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) { @@ -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<User*>::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"); - } } |