mirror of
https://github.com/znc/znc.git
synced 2026-05-02 03:22:33 +02:00
Close listening ports if we have too many open fds
The alternative to this is a busy loop which is a Bad Idea (tm). Next rehash will reopen the port anyway, so meh, this is the best we can do. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1180 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
9
znc.h
9
znc.h
@@ -236,6 +236,15 @@ public:
|
||||
virtual Csock* GetSockObj(const CString& sHost, unsigned short uPort) {
|
||||
return new CClient(sHost, uPort);
|
||||
}
|
||||
|
||||
virtual void SockError(int iErrno) {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == SockError(" << strerror(iErrno) << ")" << endl);
|
||||
if (iErrno == EMFILE) {
|
||||
// We have too many open fds, let's close this listening port to be able to continue
|
||||
// to work, next rehash will (try to) reopen it.
|
||||
Close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CListener {
|
||||
|
||||
Reference in New Issue
Block a user