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  	"testing"
     9  )
    10  
    11  func TestMaxAckBacklog(t *testing.T) {
    12  	n := 196602
    13  	major, minor := kernelVersion()
    14  	backlog := maxAckBacklog(n)
    15  	expected := 1<<16 - 1
    16  	if major > 4 || (major == 4 && minor >= 1) {
    17  		expected = n
    18  	}
    19  	if backlog != expected {
    20  		t.Fatalf(`Kernel version: "%d.%d", sk_max_ack_backlog mismatch, got %d, want %d`, major, minor, backlog, expected)
    21  	}
    22  }
    23  

View as plain text