From 80437693983321d32f20b6324128d441c5fccc49 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Wed, 23 Mar 2016 16:45:19 +0100 Subject: [PATCH] session: moves initialisation to main MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: I038d5624dc2f32e2c2d54b7e6ea388cb61122ccd Signed-off-by: José Bollo --- src/http-svc.c | 3 --- src/main.c | 5 +++-- src/session.c | 2 +- 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) { -- 2.16.6