From b5c79bf146903adc7cc1bf91ef24b741c0e85919 Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 20 Jun 2019 14:59:00 -0400 Subject: [PATCH] Fix #160 --- httplib.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/httplib.h b/httplib.h index 03ff00c..99ce401 100644 --- a/httplib.h +++ b/httplib.h @@ -1736,13 +1736,14 @@ inline bool Server::listen_internal() { is_running_ = true; for (;;) { + if (svr_sock_ == INVALID_SOCKET) { + // The server socket was closed by 'stop' method. + break; + } + auto val = detail::select_read(svr_sock_, 0, 100000); if (val == 0) { // Timeout - if (svr_sock_ == INVALID_SOCKET) { - // The server socket was closed by 'stop' method. - break; - } continue; }