if (connect(s,p->ai_addr,p->ai_addrlen) == -1) {
if (errno == EHOSTUNREACH) {
redisContextCloseFd(c);
continue;
} else if (errno == EINPROGRESS && !blocking) {
/* This is ok. */ //问题1
} else if (errno == EADDRNOTAVAIL && reuseaddr) {
if (++reuses >= REDIS_CONNECT_RETRIES) {
goto error;
} else {
goto addrretry;
}
} else {
if (redisContextWaitReady(c,c->timeout) != REDIS_OK) //问题2
goto error;
}
}
以上是hiredis客户端net.c的代码片段,有2个疑问,请高手解决一下
问题一,非阻塞三次握手不需要去判断3次握手是否完成吗,unix网络编程我记得是要select判断的
问题二,这种情形式发生在 connect是阻塞模式,但socket设置为非阻塞发生的吗