Add function that returns timeout on handle
This commit is contained in:
parent
52daeaff70
commit
910d46c53d
4
handle.c
4
handle.c
@ -53,6 +53,10 @@ int redis_handle_set_timeout(redis_handle *h, unsigned long us) {
|
||||
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) {
|
||||
if (h->fd >= 0) {
|
||||
close(h->fd);
|
||||
|
||||
1
handle.h
1
handle.h
@ -31,6 +31,7 @@ int redis_handle_init(redis_handle *h);
|
||||
int redis_handle_close(redis_handle *);
|
||||
int redis_handle_destroy(redis_handle *);
|
||||
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_in6(redis_handle *, struct sockaddr_in6 addr);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user