Otherwise, in the case of error, socket may become invalid
and we will get an incorrect error, i.e. "setsockopt(TCP_NODELAY): Invalid argument"
instead of "Connection refused"
goto error;
}
}
+ if (blocking && redisSetBlocking(c,1) != REDIS_OK)
+ goto error;
+ if (redisSetTcpNoDelay(c) != REDIS_OK)
+ goto error;
if (connect(s,p->ai_addr,p->ai_addrlen) == -1) {
if (errno == EHOSTUNREACH) {
redisContextCloseFd(c);
goto error;
}
}
- if (blocking && redisSetBlocking(c,1) != REDIS_OK)
- goto error;
- if (redisSetTcpNoDelay(c) != REDIS_OK)
- goto error;
c->flags |= REDIS_CONNECTED;
rv = REDIS_OK;