What steps will reproduce the problem?
1. Enable keep-alive
2. Do HTTP request and keep connection open ("keep-alive")
3. Call mg_stop
4. Repeat HTTP requests
What is the expected output? What do you see instead?
After the mg_stop Mongoose should stop. Due to the fact that keep-alive is
active the thread stays in process_new_connection, without returning to the
worker_thread function where the stop_flag is checked.
What version of the product are you using? On what operating system?
3.1
Please provide any additional information below.
The following change fixes the problem. It will exit process_new_connection the
next time a request is handled.
--- mongoose.c ma jul 4 09:18:12 2011
+++ mongoose_new.c ma jul 4 13:01:22 2011
@@ -3872,7 +3872,8 @@
discard_current_request_from_buffer(conn);
}
// conn->peer is not NULL only for SSL-ed proxy connections
- } while (conn->peer || (keep_alive_enabled && should_keep_alive(conn)));
+ } while ((conn->peer || (keep_alive_enabled && should_keep_alive(conn))) &&
+ (conn->ctx->stop_flag == 0));
}
// Worker threads take accepted socket from the queue
Original issue reported on code.google.com by borkh...@gmail.com on 4 Jul 2011 at 11:10
Original issue reported on code.google.com by
borkh...@gmail.com
on 4 Jul 2011 at 11:10