From 92da82858b6b8fe44f34e582967767d7f4d32f4d Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Mon, 1 Feb 2021 20:24:14 +0000 Subject: [PATCH] document the DFA --- gmid.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gmid.h b/gmid.h index e2a5e5e..4cf6266 100644 --- a/gmid.h +++ b/gmid.h @@ -128,6 +128,23 @@ struct client; typedef void (*statefn)(struct pollfd*, struct client*); +/* + * DFA: handle_handshake is the initial state, close_conn the final. + * + * handle_handshake -> handle_open_conn + * handle_handshake -> close_conn // on err + * + * handle_open_conn -> handle_cgi // via open_file/dir/... + * handle_open_conn -> send_directory_listing // ...same + * handle_open_conn -> send_file // ...same + * handle_open_conn -> close_conn // on error + * + * handle_cgi -> close_conn + * + * send_directory_listing -> close_conn + * + * send_file -> close_conn + */ struct client { struct tls *ctx; char req[GEMINI_URL_LEN];