Source file src/net/tcpconn_keepalive_conf_windows_test.go

     1  // Copyright 2024 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  //go:build windows
     6  
     7  package net
     8  
     9  import (
    10  	"internal/syscall/windows"
    11  	"syscall"
    12  	"testing"
    13  )
    14  
    15  const (
    16  	syscall_TCP_KEEPIDLE  = windows.TCP_KEEPIDLE
    17  	syscall_TCP_KEEPCNT   = windows.TCP_KEEPCNT
    18  	syscall_TCP_KEEPINTVL = windows.TCP_KEEPINTVL
    19  )
    20  
    21  type fdType = syscall.Handle
    22  
    23  func maybeSkipKeepAliveTest(t *testing.T) {
    24  	// TODO(panjf2000): Unlike Unix-like OS's, old Windows (prior to Windows 10, version 1709)
    25  	// 	doesn't provide any ways to retrieve the current TCP keep-alive settings, therefore
    26  	// 	we're not able to run the test suite similar to Unix-like OS's on Windows.
    27  	//  Try to find another proper approach to test the keep-alive settings on old Windows.
    28  	if !windows.SupportTCPKeepAliveIdle() || !windows.SupportTCPKeepAliveInterval() || !windows.SupportTCPKeepAliveCount() {
    29  		t.Skip("skipping on windows")
    30  	}
    31  }
    32  

View as plain text