Unverified Commit 05227912 authored by Ge Jun's avatar Ge Jun Committed by GitHub

Merge pull request #466 from gydong/master

 change the backlog of listen() from INT_MAX to 65535
parents 0b4117d8 fbeffa45
...@@ -337,9 +337,10 @@ int tcp_listen(EndPoint point, bool reuse_addr) { ...@@ -337,9 +337,10 @@ int tcp_listen(EndPoint point, bool reuse_addr) {
if (bind(sockfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) != 0) { if (bind(sockfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) != 0) {
return -1; return -1;
} }
if (listen(sockfd, INT_MAX) != 0) { if (listen(sockfd, 65535) != 0) {
// ^^^ kernel would silently truncate backlog to the value // ^^^ kernel would silently truncate backlog to the value
// defined in /proc/sys/net/core/somaxconn // defined in /proc/sys/net/core/somaxconn if it is less
// than 65535
return -1; return -1;
} }
return sockfd.release(); return sockfd.release();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment