Mercurial
diff seobeo/seobeo.h @ 7:114cad94008f
[Seobeo] Updated to support thread and edge server calls.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Mon, 29 Sep 2025 17:00:38 -0700 |
| parents | 1e61008b9980 |
| children | fb2cff495a60 |
line wrap: on
line diff
--- a/seobeo/seobeo.h Mon Sep 29 16:00:44 2025 -0700 +++ b/seobeo/seobeo.h Mon Sep 29 17:00:38 2025 -0700 @@ -18,6 +18,7 @@ #include <sys/wait.h> #include <signal.h> #include <fcntl.h> +#include <pthread.h> #include "dowa/dowa.h" @@ -53,6 +54,16 @@ char *file_name; } Sebeo_Handle, *Seobeo_PHandle; +typedef struct { + Seobeo_PHandle srv; + Dowa_PHashMap cache; + int evfd; // epoll‐fd or kqueue‐fd +} WorkerArgs; + +typedef enum { + SEOBEO_MODE_FORK, + SEOBEO_MODE_EDGE, +} Seobeo_ServerMode; // --- Socket, IP related --- // extern int Seobeo_CreateSocket(int32 stream, const char *host, const char* port, int32 backlog); @@ -67,7 +78,9 @@ extern void Seobeo_Web_GenerateResponseHeader(void *buffer, int status, const char *content_type, const int content_length); extern void Seobeo_Web_HandleClientRequest(Seobeo_PHandle cli, Dowa_PHashMap p_html_cache); extern int Seobeo_Web_ParseClientHeader(Seobeo_PHandle p_handle, Dowa_PHashMap map); -extern int Seobeo_Web_StartBasicHTTPServer(const char *folder_path, const char *port); +extern int Seobeo_Web_StartBasicHTTPServer(const char *folder_path, const char *port, Seobeo_ServerMode mode, int thread_count); +extern void *Seobeo_Web_Edge_Worker(void *vargs); // Maybe not web only... +extern void Seobeo_Web_Edge(Seobeo_PHandle p_server_handle, int thread_count, Dowa_PHashMap p_html_cache); // --- Helper functions --- // extern void Seobeo_Handle_Destroy(Seobeo_PHandle p_handle);