#include <keel/allocator.h>
#include <keel/chunked.h>
#include <keel/file_io.h>
#include <keel/request.h>
#include <keel/response.h>
#include <keel/parser.h>
#include <keel/router.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
◆ KL_READ_BUF_SIZE
| #define KL_READ_BUF_SIZE 8192 |
Default read buffer size (bytes).
◆ KlTls
◆ KlWsServerConn
◆ KlH2ServerConn
◆ KlH2ServerConfig
◆ KlConn
◆ KlConnState
| Enumerator |
|---|
| KL_CONN_TLS_HANDSHAKE | TLS handshake in progress
|
| KL_CONN_READING | Reading request headers
|
| KL_CONN_READING_BODY | Reading request body
|
| KL_CONN_PROCESSING | Processing request
|
| KL_CONN_SENDING | Sending response
|
| KL_CONN_WEBSOCKET | WebSocket connection (upgraded)
|
| KL_CONN_HTTP2 | HTTP/2 connection (upgraded)
|
| KL_CONN_SUSPENDED | Suspended for async operation
|
| KL_CONN_CLOSED | Connection closed
|
◆ kl_conn_pool_init()
Initialize a pre-allocated connection pool.
- Parameters
-
| pool | Pool to initialize. |
| capacity | Maximum concurrent connections. |
| alloc | Allocator for pool memory. |
- Returns
- 0 on success, -1 on failure.
◆ kl_conn_acquire()
Acquire a connection slot from the pool. Returns NULL if full.
◆ kl_conn_release()
Release a connection back to the pool (closes fd).
◆ kl_conn_pool_free()
◆ kl_conn_on_handshake()
Process TLS handshake on a connection.
- Returns
- New connection state.
◆ kl_conn_on_readable()
Process readable data on a connection (parse headers/body, invoke handler).
- Returns
- New connection state.
◆ kl_conn_on_writable()
Process writable event (send response data).
- Returns
- New connection state.
◆ kl_conn_on_file_complete()
Handle async file I/O completion (called from server tick loop).
- Parameters
-
| c | Connection that submitted the read. |
| result | Bytes read/transferred (positive) or error (negative/zero). |
| zero_copy | 1 if data was spliced directly to socket (no WRITING phase). |
- Returns
- New connection state.
◆ kl_monotonic_ms()
| uint64_t kl_monotonic_ms |
( |
void |
| ) |
|
Monotonic clock in milliseconds (for timeout tracking).