mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 14:29:10 -07:00
Fixed problem with stop
on windows
This commit is contained in:
parent
0654e5dab4
commit
9af1a4a08f
1 changed files with 8 additions and 1 deletions
|
@ -45,8 +45,12 @@
|
|||
#endif
|
||||
|
||||
#ifndef CPPHTTPLIB_IDLE_INTERVAL_USECOND
|
||||
#ifdef _WIN32
|
||||
#define CPPHTTPLIB_IDLE_INTERVAL_USECOND 10000
|
||||
#else
|
||||
#define CPPHTTPLIB_IDLE_INTERVAL_USECOND 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CPPHTTPLIB_REQUEST_URI_MAX_LENGTH
|
||||
#define CPPHTTPLIB_REQUEST_URI_MAX_LENGTH 8192
|
||||
|
@ -3974,15 +3978,18 @@ inline bool Server::listen_internal() {
|
|||
std::unique_ptr<TaskQueue> task_queue(new_task_queue());
|
||||
|
||||
while (svr_sock_ != INVALID_SOCKET) {
|
||||
#ifndef _WIN32
|
||||
if (idle_interval_sec_ > 0 || idle_interval_usec_ > 0) {
|
||||
#endif
|
||||
auto val = detail::select_read(svr_sock_, idle_interval_sec_,
|
||||
idle_interval_usec_);
|
||||
if (val == 0) { // Timeout
|
||||
task_queue->on_idle();
|
||||
continue;
|
||||
}
|
||||
#ifndef _WIN32
|
||||
}
|
||||
|
||||
#endif
|
||||
socket_t sock = accept(svr_sock_, nullptr, nullptr);
|
||||
|
||||
if (sock == INVALID_SOCKET) {
|
||||
|
|
Loading…
Reference in a new issue