aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
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;