CSocket: Close sockets which cause a EMFILE

This now closes listening sockets if we hit some fd limit like we are already
doing in CRealListener.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1544 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-06-18 19:32:12 +00:00
parent b56f173804
commit 7f7341dc2a
2 changed files with 9 additions and 0 deletions

View File

@@ -137,6 +137,14 @@ void CSocket::ReachedMaxBuffer() {
Close();
}
void CSocket::SockError(int iErrno) {
DEBUG(GetSockName() << " == SockError(" << strerror(iErrno) << ")");
if (iErrno == EMFILE) {
// We have too many open fds, this can cause a busy loop.
Close();
}
}
bool CSocket::Connect(const CString& sHostname, unsigned short uPort, bool bSSL, unsigned int uTimeout) {
CUser* pUser = m_pModule->GetUser();
CString sSockName = "MOD::C::" + m_pModule->GetModName();