From 2236f165e896ba489ca92c64d1ccdb59d3d2dc99 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 12 Mar 2022 13:01:54 +0100 Subject: [PATCH] shutdown read side instead of immediately closing socket to allow further read on other end and have a single point of cleanup only --- src/ebusd/network.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ebusd/network.cpp b/src/ebusd/network.cpp index da4e1e23..6bc27bd0 100644 --- a/src/ebusd/network.cpp +++ b/src/ebusd/network.cpp @@ -24,6 +24,8 @@ #ifdef HAVE_PPOLL # include #endif +#include +#include #include #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());