Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(87)

Unified Diff: src/pkg/net/sock_linux.go

Issue 7480046: code review 7480046: net: never use backlog > 65535 (Closed)
Patch Set: diff -r 7b6b3b170d9a https://code.google.com/p/go/ Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/net/sock_bsd.go ('k') | src/pkg/net/sock_windows.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/net/sock_linux.go
===================================================================
--- a/src/pkg/net/sock_linux.go
+++ b/src/pkg/net/sock_linux.go
@@ -21,5 +21,11 @@
if n == 0 || !ok {
return syscall.SOMAXCONN
}
+ // Linux stores the backlog in a uint16.
+ // Truncate number to avoid wrapping.
+ // See issue 5030.
+ if n > 1<<16-1 {
+ n = 1<<16 - 1
+ }
return n
}
« no previous file with comments | « src/pkg/net/sock_bsd.go ('k') | src/pkg/net/sock_windows.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b