WIP: request and connection machine
Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
parent
19fafc6a8c
commit
ab092a5f61
2 changed files with 43 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
||||||
libmuninn.so
|
libmuninn.so
|
||||||
libmuninn.dylib
|
libmuninn.dylib
|
||||||
nginx/.cache
|
nginx/.cache
|
||||||
|
.cache
|
||||||
|
|
|
||||||
42
muninn.c
42
muninn.c
|
|
@ -1,6 +1,13 @@
|
||||||
#include <ngx_config.h>
|
#include <ngx_config.h>
|
||||||
#include <ngx_core.h>
|
#include <ngx_core.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ngx_uint_t read_state;
|
||||||
|
ngx_log_t *log;
|
||||||
|
ngx_pool_t *pool;
|
||||||
|
ngx_chain_t *output;
|
||||||
|
} mun_dns_request;
|
||||||
|
|
||||||
static ngx_command_t ngx_muninn_commands[] = {};
|
static ngx_command_t ngx_muninn_commands[] = {};
|
||||||
|
|
||||||
static ngx_core_module_t ngx_muninn_module_ctx = {
|
static ngx_core_module_t ngx_muninn_module_ctx = {
|
||||||
|
|
@ -24,4 +31,39 @@ ngx_module_t ngx_muninn_core_module = {
|
||||||
NGX_MODULE_V1_PADDING
|
NGX_MODULE_V1_PADDING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void (*mun_read_handler_list[])(ngx_event_t *) = {
|
||||||
|
// list of function pointers
|
||||||
|
};
|
||||||
|
|
||||||
|
static ngx_uint_t mun_read_handler_adjacency[][7] = {
|
||||||
|
/* Entries:
|
||||||
|
* { NGX_OK next handler
|
||||||
|
* NGX_ERROR next handler
|
||||||
|
* NGX_AGAIN next handler
|
||||||
|
* NGX_BUSY next handler
|
||||||
|
* NGX_DONE next handler
|
||||||
|
* NGX_DECLINED next handler
|
||||||
|
* NGX_ABORT next handler }
|
||||||
|
*
|
||||||
|
* next handler = index into mun_read_handler_list
|
||||||
|
* ALL INDEXES BETWEEN THIS AND mun_read_handler_list MUST Match
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// configuration directives to make a configuration interface
|
||||||
|
|
||||||
|
// postconfiguration hook that actually does the work of setting up an event loop
|
||||||
|
// - calls ngx_create_listening based on sockaddr and socklen
|
||||||
|
// - sets listening->handler (see ngx_http_init_connection)
|
||||||
|
// - sets listening->pool_size
|
||||||
|
// - sets all this shit (see ngx_http_add_listening)
|
||||||
|
|
||||||
|
// listening-> init connection handler
|
||||||
|
// close connection function for error handling
|
||||||
|
// set up read event handler for conn->read->handler
|
||||||
|
// set up write event handler for conn->write->handler
|
||||||
|
// make a new request obj and set c->data
|
||||||
|
|
||||||
|
// figure out how a read is actually done
|
||||||
|
// figure out how a write is actually done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue