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 +++++++------ include/tls.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'include') 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; diff --git a/include/tls.h b/include/tls.h index 81ff613..0882ff0 100644 --- a/include/tls.h +++ b/include/tls.h @@ -5,7 +5,7 @@ struct gmnisrv_config; int tls_init(struct gmnisrv_config *conf); void tls_finish(struct gmnisrv_config *conf); -SSL *tls_get_ssl(struct gmnisrv_config *conf, int fd); +SSL *tls_get_ssl(struct gmnisrv_config *conf); void tls_set_host(SSL *ssl, struct gmnisrv_host *host); #endif -- cgit v1.2.3