applies timeout setting for apis
authorJosé Bollo <jose.bollo@iot.bzh>
Mon, 30 May 2016 10:51:17 +0000 (12:51 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Mon, 30 May 2016 11:24:24 +0000 (13:24 +0200)
Change-Id: I6ff93946990400a6e900d6d6916e2b68af92fbcc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-api-so.c
src/afb-api-so.h
src/afb-config.h
src/main.c

index 9756b0e..b741b13 100644 (file)
@@ -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;
index 8ef58a5..143b7a0 100644 (file)
@@ -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);
index c0def7c..5fe87c6 100644 (file)
@@ -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        // 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
index defab84..54cd6f6 100644 (file)
@@ -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);