sock_linux_test.go 545 B

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