Commit 910d46c5 authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

Add function that returns timeout on handle

parent 52daeaff
...@@ -53,6 +53,10 @@ int redis_handle_set_timeout(redis_handle *h, unsigned long us) { ...@@ -53,6 +53,10 @@ int redis_handle_set_timeout(redis_handle *h, unsigned long us) {
return REDIS_OK; return REDIS_OK;
} }
unsigned long redis_handle_get_timeout(redis_handle *h) {
return h->timeout.tv_sec * 1000000 + h->timeout.tv_usec;
}
int redis_handle_close(redis_handle *h) { int redis_handle_close(redis_handle *h) {
if (h->fd >= 0) { if (h->fd >= 0) {
close(h->fd); close(h->fd);
......
...@@ -31,6 +31,7 @@ int redis_handle_init(redis_handle *h); ...@@ -31,6 +31,7 @@ int redis_handle_init(redis_handle *h);
int redis_handle_close(redis_handle *); int redis_handle_close(redis_handle *);
int redis_handle_destroy(redis_handle *); int redis_handle_destroy(redis_handle *);
int redis_handle_set_timeout(redis_handle *, unsigned long us); int redis_handle_set_timeout(redis_handle *, unsigned long us);
unsigned long redis_handle_get_timeout(redis_handle *h);
int redis_handle_connect_in(redis_handle *, struct sockaddr_in addr); int redis_handle_connect_in(redis_handle *, struct sockaddr_in addr);
int redis_handle_connect_in6(redis_handle *, struct sockaddr_in6 addr); int redis_handle_connect_in6(redis_handle *, struct sockaddr_in6 addr);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment