From 1a859f380666d9b23e8740da8099fcc73901b96d Mon Sep 17 00:00:00 2001 From: psychon Date: Mon, 11 May 2009 16:06:40 +0000 Subject: [PATCH] Close client sockets only after all pending data was sent Now e.g. the message "Invalid Password" on login even reaches the other end before the connection shoots itself in the foot. There is one place in Client.cpp which I didn't change: ReachedMaxBuffer() If a client is flooding is, why should we wait until we are done answering that flood?... Thanks to morelia for making me notice this. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1506 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Client.cpp b/Client.cpp index 6d315d88..09afc5c8 100644 --- a/Client.cpp +++ b/Client.cpp @@ -295,7 +295,7 @@ void CClient::ReadLine(const CString& sData) { } else if (sCommand.Equals("QUIT")) { m_pUser->UserDisconnected(this); - Close(); // Treat a client quit as a detach + Close(Csock::CLT_AFTERWRITE); // Treat a client quit as a detach return; // Don't forward this msg. We don't want the client getting us disconnected. } else if (sCommand.Equals("PROTOCTL")) { unsigned int i = 1; @@ -652,7 +652,7 @@ void CClient::RefuseLogin(const CString& sReason) { PutStatus("Bad username and/or password."); PutClient(":irc.znc.in 464 " + GetNick() + " :" + sReason); - Close(); + Close(Csock::CLT_AFTERWRITE); } void CClientAuth::AcceptedLogin(CUser& User) { @@ -729,7 +729,7 @@ void CClient::IRCConnected(CIRCSock* pIRCSock) { void CClient::BouncedOff() { PutStatusNotice("You are being disconnected because another user just authenticated as you."); m_pIRCSock = NULL; - Close(); + Close(Csock::CLT_AFTERWRITE); } void CClient::IRCDisconnected() {