aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/afb-config.h1
-rw-r--r--src/main.c17
2 files changed, 16 insertions, 2 deletions
diff --git a/src/afb-config.h b/src/afb-config.h
index 5fe87c65..b0493268 100644
--- a/src/afb-config.h
+++ b/src/afb-config.h
@@ -54,6 +54,7 @@ struct afb_config
int cacheTimeout;
int apiTimeout;
int cntxTimeout; // Client Session Context timeout
+ int nbSessionMax; // max count of sessions
int mode; // mode of listening
int aliascount;
struct afb_config_item *items;
diff --git a/src/main.c b/src/main.c
index 54cd6f6d..9f5bc5c2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -79,6 +79,8 @@
#define DBUS_SERVICE 21
#define SO_PLUGIN 22
+#define SET_SESSIONMAX 23
+
// Command line structure hold cli --command + help text
typedef struct {
int val; // command number within application
@@ -103,7 +105,7 @@ static AFB_options cliOptions [] = {
{SET_APITIMEOUT ,1,"apitimeout" , "Plugin API timeout in seconds [default 10]"},
{SET_CNTXTIMEOUT ,1,"cntxtimeout" , "Client Session Context Timeout [default 900]"},
- {SET_CACHE_TIMEOUT,1,"cache-eol" , "Client cache end of live [default 3600s]"},
+ {SET_CACHE_TIMEOUT,1,"cache-eol" , "Client cache end of live [default 3600]"},
{SET_SESSION_DIR ,1,"sessiondir" , "Sessions file path [default rootdir/sessions]"},
@@ -120,6 +122,8 @@ static AFB_options cliOptions [] = {
{DBUS_SERVICE ,1,"dbus-server" , "provides an afb service through dbus"},
{SO_PLUGIN ,1,"plugin" , "load the plugin of path"},
+ {SET_SESSIONMAX ,1,"session-max" , "max count of session simultaneously [default 10]"},
+
{0, 0, NULL, NULL}
};
@@ -186,6 +190,10 @@ static void config_set_default (struct afb_config * config)
if (config->cntxTimeout == 0)
config->cntxTimeout = DEFLT_CNTX_TIMEOUT;
+ // max count of sessions
+ if (config->nbSessionMax == 0)
+ config->nbSessionMax = CTX_NBCLIENTS;
+
if (config->rootdir == NULL) {
config->rootdir = getenv("AFBDIR");
if (config->rootdir == NULL) {
@@ -346,6 +354,11 @@ static void parse_arguments(int argc, char *argv[], struct afb_config *config)
if (!sscanf (optarg, "%d", &config->cacheTimeout)) goto notAnInteger;
break;
+ case SET_SESSIONMAX:
+ if (optarg == 0) goto needValueForOption;
+ if (!sscanf (optarg, "%d", &config->nbSessionMax)) goto notAnInteger;
+ break;
+
case SET_FORGROUND:
if (optarg != 0) goto noValueForOption;
config->background = 0;
@@ -596,7 +609,7 @@ int main(int argc, char *argv[]) {
start_items(config->items);
config->items = NULL;
- ctxStoreInit(CTX_NBCLIENTS, config->cntxTimeout, config->token, afb_apis_count());
+ ctxStoreInit(config->nbSessionMax, config->cntxTimeout, config->token, afb_apis_count());
if (!afb_hreq_init_cookie(config->httpdPort, config->rootapi, DEFLT_CNTX_TIMEOUT)) {
ERROR("initialisation of cookies failed");
exit (1);