From 1fe107875b05cc07cf62c714c0136026eef7b93a Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 25 Oct 2020 14:50:07 -0400 Subject: Overhaul network I/O to be async for real Had to totally cut off OpenSSL from the network fd because obviously OpenSSL is just going to wreck our shit --- include/server.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include/server.h') diff --git a/include/server.h b/include/server.h index db68e33..5795426 100644 --- a/include/server.h +++ b/include/server.h @@ -10,9 +10,11 @@ struct gmnisrv_server; -enum response_state { - RESPOND_HEADER, - RESPOND_BODY, +enum client_state { + CLIENT_STATE_REQUEST, + CLIENT_STATE_SSL, + CLIENT_STATE_HEADER, + CLIENT_STATE_BODY, }; struct gmnisrv_client { @@ -24,13 +26,12 @@ struct gmnisrv_client { struct pollfd *pollfd; SSL *ssl; - BIO *bio, *sbio; + BIO *rbio, *wbio; char buf[4096]; - static_assert(GEMINI_MAX_URL + 3 < 4096, "GEMINI_MAX_URL is too high"); size_t bufix, bufln; - enum response_state state; + enum client_state state, next; enum gemini_status status; char *meta; FILE *body; -- cgit v1.2.3