CUser: Save CIRCSock* instead of looking it up every time

Via profiling ZNC it was found that much CPU time was spent inside FindSockByName()
which in turn was called by CUser::GetIRCSock():

w00t volunteered to write a patch to save that pointer inside CUser and
here is the result. Thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1053 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-05-13 18:18:51 +00:00
parent 5ddf977b16
commit a77de4ea65
3 changed files with 10 additions and 4 deletions
+2
View File
@@ -100,6 +100,8 @@ bool CZNC::OnBoot() {
bool CZNC::ConnectUser(CUser *pUser) {
CString sSockName = "IRC::" + pUser->GetUserName();
// Don't use pUser->GetIRCSock(), as that only returns something if the
// CIRCSock is already connected, not when it's still connecting!
CIRCSock* pIRCSock = (CIRCSock*) m_Manager.FindSockByName(sSockName);
if (m_pISpoofLockFile != NULL) {