aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorjustanothercatgirl <sotov@twistea.su>2025-04-01 21:37:43 +0300
committerjustanothercatgirl <sotov@twistea.su>2025-04-01 21:54:17 +0300
commita81c5876f2058605cc5f15525591acde3ae16a80 (patch)
tree37edb55c4733288c9e58a0da960a6e3918a12279 /src/main.c
parent08403b616f9dad83cb1204eec83ba1252e3eb129 (diff)
Integrated STE into html generation & cleaned up code
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index 431a9a7..3283525 100644
--- a/src/main.c
+++ b/src/main.c
@@ -49,7 +49,7 @@ enum MHD_Result process_connection(void *cls, struct MHD_Connection *connection,
} else if (handler != NULL) {
/* endpoint access */
LINFOF("Accessed endpoint at url %s", url);
- res = handler(connection, &status);
+ res = handler(method, connection, &status);
} else if ((newurl = arg->query(url + 1)) != NULL) {
LINFOF("Redirect from %s to %s", url, newurl);
response = "<!DOCTYPE html><html><body>Recirecting...</body></html>";
@@ -118,15 +118,15 @@ int main(int argc, char *argv[]) {
const char *dlpath = DEFAULT_ENDPOINTS_PATH;
const char *dbpath = DEFAULT_DATABASE_PATH;
struct MHD_Daemon *daemon = init(&sig, dlpath, dbpath);
- /* while (reload_library == 0) { */
- /* sigsuspend(&sig); */
- /* if (reload_library == 1) { */
- /* reload_dylib(dlpath, dbpath); */
- /* reload_library = 0; */
- /* } */
- /* } */
- getchar();
- if (arg.destructor) arg.destructor();
+ while (reload_library == 0) {
+ sigsuspend(&sig);
+ if (reload_library == 1) {
+ reload_dylib(dlpath, dbpath);
+ reload_library = 0;
+ }
+ }
+ getchar(); /* to be replaced with fork later */
+ arg.destructor();
dlclose(arg.dylib);
MHD_stop_daemon(daemon);
return 0;