1// Copyright 2020 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package net 6 7import ( 8 "internal/syscall/unix" 9 "testing" 10) 11 12func TestMaxAckBacklog(t *testing.T) { 13 n := 196602 14 major, minor := unix.KernelVersion() 15 backlog := maxAckBacklog(n) 16 expected := 1<<16 - 1 17 if major > 4 || (major == 4 && minor >= 1) { 18 expected = n 19 } 20 if backlog != expected { 21 t.Fatalf(`Kernel version: "%d.%d", sk_max_ack_backlog mismatch, got %d, want %d`, major, minor, backlog, expected) 22 } 23} 24