Server (IO Thread)

Functions and types used to start up the libyimmo core server for WSGI.

Setup

ymo_server_t *ymo_wsgi_server_init(struct ev_loop *loop, in_port_t http_port, ymo_wsgi_proc_t *proc)

Create a new yimmo HTTP server using ymo_http_simple_init(), storing the current ymo_wsgi_proc_t as the server’s data attribute.

ymo_status_t ymo_wsgi_server_start(struct ev_loop *loop)

(At the moment, this is a no-op).

Yimmo Callbacks

ymo_status_t ymo_wsgi_server_header_cb(ymo_http_session_t *http_session, ymo_http_request_t *request, ymo_http_response_t *response, void *user_data)

HTTP header callback, invoked by libyimmo_http.

See also: ymo_http_header_cb_t

ymo_status_t ymo_wsgi_server_request_cb(ymo_http_session_t *http_session, ymo_http_request_t *request, ymo_http_response_t *response, void *user_data)

HTTP handler callback, invoked by libyimmo_http.

See also: ymo_http_cb_t

EV Watcher Callbacks

void ymo_wsgi_server_prepare(struct ev_loop *loop, ev_prepare *w, int revents)

We use an ev_prepare_watcher to check the worker thread output queue for response data before entering the ev loop to wait on events.

void ymo_wsgi_server_check(struct ev_loop *loop, ev_check *w, int revents)

We use an ev_check_watcher to check the output queue for response data when the event loop wakes back up after waiting on events.

void ymo_wsgi_server_async(struct ev_loop *loop, ev_async *w, int revents)

This is the callback function for the server’s ev_async_watcher, which is used by the worker thread (using ev_async_send) to notify the IO thread that some response data is ready for processing.