Merge branch '3.0' into enh/opt-transport

This commit is contained in:
yihaoDeng 2024-09-15 08:15:08 +08:00
parent cca3319292
commit 9ac3ca9b2f
2 changed files with 33 additions and 16 deletions

View File

@ -138,6 +138,7 @@ int32_t taosShutDownSocketRDWR(TdSocketPtr pSocket);
int32_t taosShutDownSocketServerRDWR(TdSocketServerPtr pSocketServer);
int32_t taosSetNonblocking(TdSocketPtr pSocket, int32_t on);
int32_t taosSetSockOpt(TdSocketPtr pSocket, int32_t level, int32_t optname, void *optval, int32_t optlen);
int32_t taosSetSockOpt2(int32_t fd);
int32_t taosGetSockOpt(TdSocketPtr pSocket, int32_t level, int32_t optname, void *optval, int32_t *optlen);
int32_t taosWriteMsg(TdSocketPtr pSocket, void *ptr, int32_t nbytes);
int32_t taosReadMsg(TdSocketPtr pSocket, void *ptr, int32_t nbytes);
@ -171,6 +172,7 @@ const char *taosInetNtoa(struct in_addr ipInt, char *dstStr, int32_t len);
uint64_t taosHton64(uint64_t val);
uint64_t taosNtoh64(uint64_t val);
int32_t taosSetSockOpt2(int32_t fd);
#ifdef __cplusplus
}
#endif

View File

@ -1212,3 +1212,18 @@ uint64_t taosNtoh64(uint64_t val) {
}
#endif
}
int32_t taosSetSockOpt2(int32_t fd) {
#if defined(WINDOWS) || defined(DARWIN)
return 0;
#else
int32_t ret = setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){1}, sizeof(int));
if (ret < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
return terrno;
} else {
return 0;
}
#endif
return 0;
}