diff options
Diffstat (limited to 'src/usermanager.cpp')
-rw-r--r-- | src/usermanager.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 06d6ad1cd..f620a264d 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -195,13 +195,14 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char if (IS_LOCAL(user)) { - FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(IS_LOCAL(user))); - user->DoWrite(); - if (user->GetIOHook()) + LocalUser* lu = IS_LOCAL(user); + FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(lu)); + lu->DoWrite(); + if (lu->GetIOHook()) { try { - user->GetIOHook()->OnStreamSocketClose(user); + lu->GetIOHook()->OnStreamSocketClose(lu); } catch (CoreException& modexcept) { @@ -209,10 +210,8 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char } } - ServerInstance->SE->DelFd(user); - user->Close(); - // user->Close() will set fd to -1; this breaks IS_LOCAL. Fix - user->SetFd(INT_MAX); + ServerInstance->SE->DelFd(lu); + lu->Close(); } /* |