Source file src/net/sock_linux_test.go

     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  
     5  package net
     6  
     7  import (
     8  	"internal/syscall/unix"
     9  	"testing"
    10  )
    11  
    12  func 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  

View as plain text