restoring cookie of session
[src/app-framework-binder.git] / src / main.c
index b0261a4..d58a897 100644 (file)
@@ -30,7 +30,8 @@
 #include "afb-plugin.h"
 
 #include "local-def.h"
-#include "afb-apis.h"
+#include "afb-hswitch.h"
+#include "afb-api-so.h"
 #include "afb-hsrv.h"
 #include "afb-hreq.h"
 #include "session.h"
@@ -513,9 +514,13 @@ int main(int argc, char *argv[])  {
   }
 
   if (session->config->ldpaths) 
-    afb_apis_add_pathset(session->config->ldpaths);
+    afb_api_so_add_pathset(session->config->ldpaths);
 
-  ctxStoreInit(CTX_NBCLIENTS, session->config->cntxTimeout, afb_apis_count(), session->config->token);
+  ctxStoreInit(CTX_NBCLIENTS, session->config->cntxTimeout, session->config->token);
+  if (!afb_hreq_init_cookie(session->config->httpdPort, session->config->rootapi, DEFLT_CNTX_TIMEOUT)) {
+    fprintf (stderr, "ERR: initialisation of cookies failed\n");
+     exit (1);
+  }
 
   install_error_handlers();
 
@@ -569,10 +574,10 @@ static int init(struct afb_hsrv *hsrv, AFB_config * config)
 {
        int idx;
 
-       if (!afb_hsrv_add_handler(hsrv, config->rootapi, afb_hreq_websocket_switch, NULL, 20))
+       if (!afb_hsrv_add_handler(hsrv, config->rootapi, afb_hswitch_websocket_switch, NULL, 20))
                return 0;
 
-       if (!afb_hsrv_add_handler(hsrv, config->rootapi, afb_hreq_rest_api, NULL, 10))
+       if (!afb_hsrv_add_handler(hsrv, config->rootapi, afb_hswitch_apis, NULL, 10))
                return 0;
 
        for (idx = 0; config->aliasdir[idx].url != NULL; idx++)
@@ -582,7 +587,7 @@ static int init(struct afb_hsrv *hsrv, AFB_config * config)
        if (!afb_hsrv_add_alias(hsrv, "", config->rootdir, -10))
                return 0;
 
-       if (!afb_hsrv_add_handler(hsrv, config->rootbase, afb_hreq_one_page_api_redirect, NULL, -20))
+       if (!afb_hsrv_add_handler(hsrv, config->rootbase, afb_hswitch_one_page_api_redirect, NULL, -20))
                return 0;
 
        return 1;