info: completely switch of caching for timeouts <= 0
authorFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 8 Apr 2016 07:59:29 +0000 (09:59 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 8 Apr 2016 08:37:49 +0000 (10:37 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/info/olsrd_info.c

index 9053d6e..a0cd9cf 100644 (file)
@@ -138,6 +138,11 @@ static unsigned long long SIW_ENTRIES_ALL[] = {
     };
 
 long cache_timeout_generic(info_plugin_config_t *plugin_config, unsigned long long siw) {
+  long timeout = plugin_config->cache_timeout;
+  if (timeout <= 0) {
+    return timeout;
+  }
+
   switch (siw) {
     case SIW_NEIGHBORS:
     case SIW_LINKS:
@@ -149,7 +154,7 @@ long cache_timeout_generic(info_plugin_config_t *plugin_config, unsigned long lo
     case SIW_INTERFACES:
     case SIW_2HOP:
     case SIW_SGW:
-      return plugin_config->cache_timeout;
+      return timeout;
 
     case SIW_VERSION:
     case SIW_CONFIG: