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
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 {