Host "localhost"
Port 6379
Database 0
- Timeout 0
+ Timeout 1.0
Retention 0
StoreRates true
Prefix ""
=item B<Timeout> I<Seconds>
-The B<Timeout> option sets the socket connection timeout in seconds. Use
-fractional numbers to specify timeouts shorter than one second, e.g. C<0.5> for
-500 ms.
+The B<Timeout> option sets the socket connection timeout in seconds. Use zero
+to disable to connect without a timeout. Use fractional numbers to specify
+timeouts shorter than one second, e.g. C<0.5> for 500 ms. Defaults to one
+second.
=item B<Retention> I<Seconds>
#include <hiredis/hiredis.h>
#include <sys/time.h>
-#ifndef REDIS_DEFAULT_PORT
-#define REDIS_DEFAULT_PORT 6379
-#endif
+static int const default_port = 6379;
+static cdtime_t const default_timeout = TIME_T_TO_CDTIME_T(1);
struct wr_node_s;
typedef struct wr_node_s wr_node_t;
ERROR("write_redis plugin: Connecting to host \"%s\" (port %i) failed: "
"Unknown reason",
(node->host != NULL) ? node->host : "localhost",
- (node->port != 0) ? node->port : REDIS_DEFAULT_PORT);
+ (node->port != 0) ? node->port : default_port);
return ENOTCONN;
}
if (node->conn->err) {
ERROR("write_redis plugin: Connecting to host \"%s\" (port %i) failed: %s",
(node->host != NULL) ? node->host : "localhost",
- (node->port != 0) ? node->port : REDIS_DEFAULT_PORT,
- node->conn->errstr);
+ (node->port != 0) ? node->port : default_port, node->conn->errstr);
disconnect(node);
return ENOTCONN;
}
*node = (wr_node_t){
.store_rates = true,
- .port = REDIS_DEFAULT_PORT,
+ .port = default_port,
+ .timeout = default_timeout,
.reconnect = reconnect,
.disconnect = disconnect,