clean up dead connections regularly

This commit is contained in:
John
2021-11-12 19:14:33 +01:00
parent 93542a4f90
commit bb8e9ed06a
+5
View File
@@ -275,7 +275,11 @@ void Network::run() {
} }
#endif #endif
#endif #endif
int cleanupCnt = 0;
while (true) { while (true) {
if (++cleanupCnt > 10) {
cleanConnections();
}
#ifdef HAVE_PPOLL #ifdef HAVE_PPOLL
// wait for new fd event // wait for new fd event
ret = ppoll(fds, nfds, &tdiff, nullptr); ret = ppoll(fds, nfds, &tdiff, nullptr);
@@ -289,6 +293,7 @@ void Network::run() {
#endif #endif
if (ret == 0) { if (ret == 0) {
cleanConnections(); cleanConnections();
cleanupCnt = 0;
continue; continue;
} }
bool newData = false, isHttp = false; bool newData = false, isHttp = false;