summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-05-30 12:51:17 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-05-30 13:24:24 +0200
commitb41ed8f8cbbdf7cff415f69f6f9b4a92cfe1f37d (patch)
tree1e908e66786a4da93e1385aa2d4962d5dd7367c8
parent0ae7af342a90c2909051e4ec6760d57d6f7bc2d3 (diff)
applies timeout setting for apis
Change-Id: I6ff93946990400a6e900d6d6916e2b68af92fbcc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-api-so.c5
-rw-r--r--src/afb-api-so.h2
-rw-r--r--src/afb-config.h2
-rw-r--r--src/main.c1
4 files changed, 9 insertions, 1 deletions
diff --git a/src/afb-api-so.c b/src/afb-api-so.c
index 9756b0e0..b741b13a 100644
--- a/src/afb-api-so.c
+++ b/src/afb-api-so.c
@@ -53,6 +53,11 @@ static int api_timeout = 15;
static const char plugin_register_function_v1[] = "pluginAfbV1Register";
+void afb_api_so_set_timeout(int to)
+{
+ api_timeout = to;
+}
+
static int afb_api_so_event_broadcast(struct api_so_desc *desc, const char *name, struct json_object *object)
{
size_t length;
diff --git a/src/afb-api-so.h b/src/afb-api-so.h
index 8ef58a53..143b7a05 100644
--- a/src/afb-api-so.h
+++ b/src/afb-api-so.h
@@ -18,6 +18,8 @@
#pragma once
+extern void afb_api_so_set_timeout(int to);
+
extern int afb_api_so_add_plugin(const char *path);
extern int afb_api_so_add_directory(const char *path);
diff --git a/src/afb-config.h b/src/afb-config.h
index c0def7c8..5fe87c65 100644
--- a/src/afb-config.h
+++ b/src/afb-config.h
@@ -24,7 +24,7 @@
#define MAX_ALIAS 10 // max number of aliases
#define DEFLT_CNTX_TIMEOUT 3600 // default Client Connection Timeout
-#define DEFLT_API_TIMEOUT 0 // default Plugin API Timeout [0=NoLimit for Debug Only]
+#define DEFLT_API_TIMEOUT 20 // default Plugin API Timeout [0=NoLimit for Debug Only]
#define DEFLT_CACHE_TIMEOUT 100000 // default Static File Chache [Client Side Cache 100000~=1day]
#define DEFLT_AUTH_TOKEN NULL // expect for debug should == NULL
#define DEFLT_HTTP_TIMEOUT 15 // Max MibMicroHttp timeout
diff --git a/src/main.c b/src/main.c
index defab848..54cd6f6d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -585,6 +585,7 @@ int main(int argc, char *argv[]) {
exit (1);
}
+ afb_api_so_set_timeout(config->apiTimeout);
if (config->ldpaths) {
if (afb_api_so_add_pathset(config->ldpaths) < 0) {
ERROR("initialisation of plugins within %s failed", config->ldpaths);