Merge pull request #3513 from taosdata/bugfix/td-1359

[TD-1359]<fix>: set recv timeout of accepted tcp socket to avoid infinite wait when peer send a corrupt message
This commit is contained in:
Shengliang Guan 2020-09-14 16:19:45 +08:00 committed by GitHub
commit 86230219af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -245,6 +245,8 @@ static void *taosAcceptTcpConnection(void *arg) {
}
taosKeepTcpAlive(connFd);
struct timeval to={1, 0};
taosSetSockOpt(connFd, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof(to));
// pick up the thread to handle this connection
pThreadObj = pServerObj->pThreadObj + threadId;