From: Pavel Rochnyack Date: Sun, 17 Jun 2018 12:09:21 +0000 (+0700) Subject: write_redis plugin: Fixed bug of Timeout option X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d41b166d16eaed2f10cc1b42cc443e32ead9843e;p=collectd.git write_redis plugin: Fixed bug of Timeout option Documentation states what Timeout is set in milliseconds. Code was fixed to match documentation. --- diff --git a/src/write_redis.c b/src/write_redis.c index c17654b4..72cb5946 100644 --- a/src/write_redis.c +++ b/src/write_redis.c @@ -184,8 +184,8 @@ static int wr_config_node(oconfig_item_t *ci) /* {{{ */ return ENOMEM; node->host = NULL; node->port = 0; - node->timeout.tv_sec = 0; - node->timeout.tv_usec = 1000; + node->timeout.tv_sec = 1; + node->timeout.tv_usec = 0; node->conn = NULL; node->prefix = NULL; node->database = 0; @@ -213,8 +213,11 @@ static int wr_config_node(oconfig_item_t *ci) /* {{{ */ } } else if (strcasecmp("Timeout", child->key) == 0) { status = cf_util_get_int(child, &timeout); - if (status == 0) - node->timeout.tv_usec = timeout; + if (status == 0) { + node->timeout.tv_usec = timeout * 1000; + node->timeout.tv_sec = node->timeout.tv_usec / 1000000L; + node->timeout.tv_usec %= 1000000L; + } } else if (strcasecmp("Prefix", child->key) == 0) { status = cf_util_get_string(child, &node->prefix); } else if (strcasecmp("Database", child->key) == 0) {