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  	backlog := maxAckBacklog(n)
    15  	expected := 1<<16 - 1
    16  	if unix.KernelVersionGE(4, 1) {
    17  		expected = n
    18  	}
    19  	if backlog != expected {
    20  		t.Fatalf(`sk_max_ack_backlog mismatch, got %d, want %d`, backlog, expected)
    21  	}
    22  }
    23  

View as plain text