提交 794fd7ec 编写于 作者: G Ganlin Zhao

Revert "fix: set connect socket to unblocking call with timeout"

This reverts commit 14a57d9b.
上级 9b0fa37e
Subproject commit 54eaed1d8b56b1aa528be3bdd1877e59c56fa90c
Subproject commit ea6b3e973b477b8061e0076bb257dbd7f3faa756
Subproject commit 5afdb16902d507064deb79a5c0b87d7c9ef6ff3d
Subproject commit 7da3cc9e4ad1030c2eec250b869a8fa215b4a4b4
Subproject commit af97c27502269351dc9b5119c882720788f69687
Subproject commit 82fae157e23f0fb1b05d9e4664c842bc5c8211b8
Subproject commit a80b1a7c6a741502988a0930d40fa82bddd39346
Subproject commit 23e2b73fb2fba1a718f31c95513dbabeed21220a
Subproject commit ac79ade213e8efd2c699560625ca0eaee116cef1
Subproject commit 1794a8019c1fa3e601e2c89b64582c8fdc59a27f
......@@ -386,44 +386,6 @@ SOCKET taosOpenTcpClientSocket(uint32_t destIp, uint16_t destPort, uint32_t clie
}
}
taosSetNonblocking(sockFd, 0);
#elif _TD_WINDOWS
taosSetNonblocking(sockFd, 1);
ret = connect(sockFd, (struct sockaddr *)&serverAddr, sizeof(serverAddr));
if (ret == -1) {
if (errno == EHOSTUNREACH) {
uError("failed to connect socket, ip:0x%x, port:%hu(%s)", destIp, destPort, strerror(errno));
taosCloseSocket(sockFd);
return -1;
} else if (errno == EINPROGRESS || errno == EAGAIN || errno == EWOULDBLOCK) {
timeval timeout;
fd_set set;
timeout.tv_sec = 0;
timeout.tv_usec = tsTcpConnTimeout * 1000;
FD_ZERO(&set);
FD_SET(sockFd, &set);
if (select(sockFd + 1, NULL, &set, NULL, &timeout) <= 0) {
uError("failed to connect socket, ip:0x%x, port:%hu(poll error/conn timeout)", destIp, destPort);
taosCloseSocket(sockFd); //
return -1;
}
int optVal = -1, optLen = sizeof(int);
if ((0 != taosGetSockOpt(sockFd, SOL_SOCKET, SO_ERROR, &optVal, &optLen)) || (optVal != 0)) {
uError("failed to connect socket, ip:0x%x, port:%hu(connect host error)", destIp, destPort);
taosCloseSocket(sockFd); //
return -1;
}
ret = 0;
} else {
uError("failed to connect socket, ip:0x%x, port:%hu(target host cannot be reached)", destIp, destPort);
taosCloseSocket(sockFd); //
return -1;
}
}
taosSetNonblocking(sockFd, 0);
#else
ret = connect(sockFd, (struct sockaddr *)&serverAddr, sizeof(serverAddr));
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册