yhirose 6 年之前
父节点
当前提交
b5c79bf146
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      httplib.h

+ 5 - 4
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;
     }