aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-03-23 16:45:19 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-03-23 16:45:19 +0100
commit80437693983321d32f20b6324128d441c5fccc49 (patch)
treeceb12fb6fe959ef292380bbcbf3534c20e287254
parentfe79c7ba875a9203020e72e82fa3524fd2fb74d2 (diff)
session: moves initialisation to main
Change-Id: I038d5624dc2f32e2c2d54b7e6ea388cb61122ccd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/http-svc.c3
-rw-r--r--src/main.c5
-rw-r--r--src/session.c2
3 files changed, 4 insertions, 6 deletions
diff --git a/src/http-svc.c b/src/http-svc.c
index 99c4142a..480925db 100644
--- a/src/http-svc.c
+++ b/src/http-svc.c
@@ -325,9 +325,6 @@ AFB_error httpdStart(AFB_session * session)
return AFB_FATAL;
}
- /* Initialise Client Session Hash Table */
- ctxStoreInit(CTX_NBCLIENTS);
-
#if defined(USE_MAGIC_MIME_TYPE)
/*TBD open libmagic cache [fail to pass EFENCE check (allocating 0 bytes)] */
init_lib_magic (session);
diff --git a/src/main.c b/src/main.c
index f73cfac0..e9cddcb5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -503,8 +503,6 @@ int main(int argc, char *argv[]) {
on_exit(closeSession, session);
parse_arguments(argc, argv, session);
- initPlugins(session);
-
// ------------------ sanity check ----------------------------------------
if ((session->background) && (session->foreground)) {
fprintf (stderr, "ERR: cannot select foreground & background at the same time\n");
@@ -515,6 +513,9 @@ int main(int argc, char *argv[]) {
exit (1);
}
+ initPlugins(session);
+ ctxStoreInit(CTX_NBCLIENTS);
+
// ------------------ Some useful default values -------------------------
if ((session->background == 0) && (session->foreground == 0)) session->foreground=1;
diff --git a/src/session.c b/src/session.c
index 9d03d0a7..3b9288f8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -343,7 +343,7 @@ PUBLIC void ctxStoreInit (int nbSession) {
// let's create as store as hashtable does not have any
sessions.store = calloc (1 + (unsigned)nbSession, sizeof(AFB_clientCtx));
- sessions.max=nbSession;
+ sessions.max = nbSession;
}
STATIC AFB_clientCtx *ctxStoreSearch (const char* uuid) {