commit
a70c34b413
|
@ -241,7 +241,7 @@ static void *taosAcceptTcpConnection(void *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
taosKeepTcpAlive(connFd);
|
taosKeepTcpAlive(connFd);
|
||||||
struct timeval to={1, 0};
|
struct timeval to={5, 0};
|
||||||
int32_t ret = taosSetSockOpt(connFd, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof(to));
|
int32_t ret = taosSetSockOpt(connFd, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof(to));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
taosCloseSocket(connFd);
|
taosCloseSocket(connFd);
|
||||||
|
|
|
@ -283,6 +283,7 @@ SOCKET taosOpenTcpClientSocket(uint32_t destIp, uint16_t destPort, uint32_t clie
|
||||||
SOCKET sockFd = 0;
|
SOCKET sockFd = 0;
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
struct sockaddr_in serverAddr, clientAddr;
|
struct sockaddr_in serverAddr, clientAddr;
|
||||||
|
int32_t bufSize = 1024 * 1024;
|
||||||
|
|
||||||
sockFd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
sockFd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
|
||||||
|
@ -300,6 +301,18 @@ SOCKET taosOpenTcpClientSocket(uint32_t destIp, uint16_t destPort, uint32_t clie
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (taosSetSockOpt(sockFd, SOL_SOCKET, SO_SNDBUF, (void *)&bufSize, sizeof(bufSize)) != 0) {
|
||||||
|
uError("failed to set the send buffer size for TCP socket\n");
|
||||||
|
taosCloseSocket(sockFd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taosSetSockOpt(sockFd, SOL_SOCKET, SO_RCVBUF, (void *)&bufSize, sizeof(bufSize)) != 0) {
|
||||||
|
uError("failed to set the receive buffer size for TCP socket\n");
|
||||||
|
taosCloseSocket(sockFd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (clientIp != 0) {
|
if (clientIp != 0) {
|
||||||
memset((char *)&clientAddr, 0, sizeof(clientAddr));
|
memset((char *)&clientAddr, 0, sizeof(clientAddr));
|
||||||
clientAddr.sin_family = AF_INET;
|
clientAddr.sin_family = AF_INET;
|
||||||
|
|
Loading…
Reference in New Issue