提交 469cf6d6 编写于 作者: 陶建辉(Jeff)'s avatar 陶建辉(Jeff)

remove re-useaddr for UDP socket

上级 40dace79
......@@ -222,9 +222,7 @@ int taosReadn(int fd, char *ptr, int nbytes) {
int taosOpenUdpSocket(uint32_t ip, uint16_t port) {
struct sockaddr_in localAddr;
int sockFd;
int ttl = 128;
int reuse, nocheck;
int bufSize = 8192000;
int bufSize = 1024000;
uTrace("open udp socket:0x%x:%hu", ip, port);
......@@ -238,31 +236,6 @@ int taosOpenUdpSocket(uint32_t ip, uint16_t port) {
return -1;
}
reuse = 1;
if (taosSetSockOpt(sockFd, SOL_SOCKET, SO_REUSEADDR, (void *)&reuse, sizeof(reuse)) < 0) {
uError("setsockopt SO_REUSEADDR failed): %d (%s)", errno, strerror(errno));
close(sockFd);
return -1;
};
nocheck = 1;
if (taosSetSockOpt(sockFd, SOL_SOCKET, SO_NO_CHECK, (void *)&nocheck, sizeof(nocheck)) < 0) {
if (!taosSkipSocketCheck()) {
uError("setsockopt SO_NO_CHECK failed: %d (%s)", errno, strerror(errno));
close(sockFd);
return -1;
} else {
uPrint("Skipping setsockopt SO_NO_CHECK error: %d (%s)", errno, strerror(errno));
}
}
ttl = 128;
if (taosSetSockOpt(sockFd, IPPROTO_IP, IP_TTL, (void *)&ttl, sizeof(ttl)) < 0) {
uError("setsockopt IP_TTL failed: %d (%s)", errno, strerror(errno));
close(sockFd);
return -1;
}
if (taosSetSockOpt(sockFd, SOL_SOCKET, SO_SNDBUF, (void *)&bufSize, sizeof(bufSize)) != 0) {
uError("failed to set the send buffer size for UDP socket\n");
close(sockFd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册