Browse Source

netutil: deflake TestLimitListener (again)

This change adds missing accept-queue length check.

Change-Id: Ifefc5c614a1a34af51411976ced096c55b95fb8f
Reviewed-on: https://go-review.googlesource.com/11536
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Mikio Hara 10 years ago
parent
commit
8bfde94a84
1 changed files with 3 additions and 0 deletions
  1. 3 0
      netutil/listen_test.go

+ 3 - 0
netutil/listen_test.go

@@ -27,6 +27,9 @@ import (
 func TestLimitListener(t *testing.T) {
 	const max = 5
 	attempts := (nettest.MaxOpenFiles() - max) / 2
+	if attempts > 256 { // maximum length of accept queue is 128 by default
+		attempts = 256
+	}
 
 	l, err := net.Listen("tcp", "127.0.0.1:0")
 	if err != nil {