Set QoS flag for UDP forwarding

This commit is contained in:
Max Lv
2016-08-08 09:15:29 +08:00
parent 915047e957
commit e62a73e67d
+8
View File
@@ -147,6 +147,10 @@ int create_and_bind(const char *addr, const char *port)
LOGI("tcp port reuse enabled");
}
// Set QoS flag
int tos = 46;
setsockopt(remotefd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))
s = bind(listen_sock, rp->ai_addr, rp->ai_addrlen);
if (s == 0) {
/* We managed to bind successfully! */
@@ -643,6 +647,10 @@ static void accept_cb(EV_P_ ev_io *w, int revents)
setsockopt(remotefd, SOL_TCP, TCP_KEEPINTVL, (void *)&keepInterval, sizeof(keepInterval));
setsockopt(remotefd, SOL_TCP, TCP_KEEPCNT, (void *)&keepCount, sizeof(keepCount));
// Set QoS flag
int tos = 46;
setsockopt(remotefd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))
// Set non blocking
setnonblocking(remotefd);