mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-21 20:01:46 +00:00
Support keep-alive parking in SSLServer
SSLServer::TlsConnection plugs the TLS session into the parked connection. A worker runs the handshake when the event loop sees the ClientHello, so a connection that has not started it, or has gone quiet after it, waits in the event loop instead of holding a worker. The handshake counts as having read what the loop saw, and a connection that has finished it waits for room like a served one when the queue is full. close_notify sent from the event loop does not block. SSLServer::start_session() holds the session setup and handshake that both the blocking path and TlsConnection use, and supports_keep_alive_parking() goes away.
This commit is contained in:
1 parent
d730627815
commit
b99ccee3db
3 files changed
+160
-39
No files matched your search
@@ -930,10 +930,11 @@ By default, a kept-alive connection holds a worker thread while it waits for its
|
||||
With it:
|
||||
|
||||
- Consecutive requests on a connection may run on different threads.
|
||||
- When the [max queued requests](#max-queued-requests) limit is reached, only a connection that has not been served yet is closed. An established one waits for room.
|
||||
- When the [max queued requests](#max-queued-requests) limit is reached, only a connection that has not been served yet (or, with `SSLServer`, has not finished its TLS handshake) is closed. An established one waits for room.
|
||||
- Each request pays for handing the connection over, so with no more connections than threads and very light handlers, it can serve fewer requests per second.
|
||||
- A handler, a content provider and a WebSocket still hold their thread while they run.
|
||||
- `SSLServer` ignores it for now.
|
||||
- A subclass that overrides the private `process_and_close_socket()` is bypassed.
|
||||
- `SSLServer` runs the TLS handshake on a worker when the client starts it. Until then the connection waits in the event loop and is closed at the keep-alive timeout, not the read timeout, and `ssl_last_error()` is not set for it.
|
||||
|
||||
### Client address behind a reverse proxy
|
||||
|
||||
|
||||
Reference in new issue
Block a user