shutdown read side instead of immediately closing socket to allow further read on other end and have a single point of cleanup only

This commit is contained in:
John
2022-03-12 13:01:54 +01:00
parent af6decf96c
commit 2236f165e8
+3 -2
View File
@@ -24,6 +24,8 @@
#ifdef HAVE_PPOLL
# include <poll.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <cstring>
#include "lib/utils/log.h"
@@ -184,8 +186,7 @@ void Connection::run() {
}
if (m_socket) {
delete m_socket;
m_socket = nullptr;
shutdown(sockFD, SHUT_RD);
}
time(&m_endedAt);
logInfo(lf_network, "[%05d] connection closed", getID());