Fix incorrect "no route to host" errors.
If getaddrinfo(3) includes an AF_INET6 address before an AF_INET address on a host with only IPv4 network connectivity then the redisContextConnectTcp call would fail with "no route to host". This commit fixes this issue by specifically handling the errno EHOSTUNREACH error and entering another iteration of the addrinfo loop. This will allow following AF_INET addresses to be attempted.
This commit is contained in:
parent
3afe2585de
commit
c4ed06d90c
5
net.c
5
net.c
@ -208,7 +208,10 @@ int redisContextConnectTcp(redisContext *c, const char *addr, int port, struct t
|
||||
if (redisSetBlocking(c,s,0) != REDIS_OK)
|
||||
goto error;
|
||||
if (connect(s,p->ai_addr,p->ai_addrlen) == -1) {
|
||||
if (errno == EINPROGRESS && !blocking) {
|
||||
if (errno == EHOSTUNREACH) {
|
||||
close(s);
|
||||
continue;
|
||||
} else if (errno == EINPROGRESS && !blocking) {
|
||||
/* This is ok. */
|
||||
} else {
|
||||
if (redisContextWaitReady(c,s,timeout) != REDIS_OK)
|
||||
|
Loading…
x
Reference in New Issue
Block a user