summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-10-25 14:50:07 -0400
committerDrew DeVault <sir@cmpwn.com>2020-10-25 14:50:07 -0400
commit1fe107875b05cc07cf62c714c0136026eef7b93a (patch)
tree463fa81cf3f67012ed542331cf072c10c72eaafd /include
parenta22bec51494a50c044416d469cc33e043480e7fd (diff)
downloadgmnisrv-1fe107875b05cc07cf62c714c0136026eef7b93a.tar.gz
gmnisrv-1fe107875b05cc07cf62c714c0136026eef7b93a.tar.xz
gmnisrv-1fe107875b05cc07cf62c714c0136026eef7b93a.zip
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
Diffstat (limited to 'include')
-rw-r--r--include/server.h13
-rw-r--r--include/tls.h2
2 files changed, 8 insertions, 7 deletions
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