From f8cc752a9a80eae4087ff85ca0290240ef6bb93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Fri, 24 Aug 2018 19:11:30 +0200 Subject: [PATCH] Check response 0 on disconnect From recv(): The return value will be 0 when the peer has performed an orderly shutdown --- src/connection_unix.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/connection_unix.cpp b/src/connection_unix.cpp index 6fe359e..85dace3 100644 --- a/src/connection_unix.cpp +++ b/src/connection_unix.cpp @@ -118,5 +118,8 @@ bool BaseConnection::Read(void* data, size_t length) } Close(); } + else if (res == 0) { + Close(); + } return res == (int)length; }