diff options
author | Omar Polo <op@omarpolo.com> | 2021-02-08 10:01:45 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-02-08 10:01:45 +0000 |
commit | abc007d2b32f597054399bd8fe72c1fbffdfb6a9 (patch) | |
tree | 1380b46057b39b60df96c3a32883f80967325df4 /gmid.h | |
parent | b63e30ff449ee1cf0091d5431f9b72cdd3b1e7e0 (diff) |
rewrite main loop using libevent
Diffstat (limited to 'gmid.h')
-rw-r--r-- | gmid.h | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -24,7 +24,6 @@ #include <netinet/in.h> #include <dirent.h> -#include <poll.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -34,10 +33,6 @@ #include "config.h" -#ifndef INFTIM -# define INFTIM -1 -#endif - #define GEMINI_URL_LEN (1024+3) /* URL max len + \r\n + \0 */ #define SUCCESS 20 @@ -134,7 +129,7 @@ struct parser { struct client; -typedef void (*statefn)(struct pollfd*, struct client*); +typedef void (*statefn)(int, short, void*); /* * DFA: handle_handshake is the initial state, close_conn the final. @@ -165,14 +160,14 @@ struct client { char req[GEMINI_URL_LEN]; struct iri iri; char domain[DOMAIN_NAME_LEN]; - statefn state, next; + statefn next; int code; const char *meta; - int fd, waiting_on_child; + int fd, pfd; + DIR *dir; char sbuf[1024]; /* static buffer */ void *buf, *i; /* mmap buffer */ ssize_t len, off; /* mmap/static buffer */ - DIR *dir; struct sockaddr_storage addr; struct vhost *host; /* host she's talking to */ }; |