Source file src/net/error_windows_test.go

     1  // Copyright 2015 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  	"errors"
     9  	"syscall"
    10  )
    11  
    12  var (
    13  	errTimedout       = syscall.ETIMEDOUT
    14  	errOpNotSupported = syscall.EOPNOTSUPP
    15  
    16  	abortedConnRequestErrors = []error{syscall.ERROR_NETNAME_DELETED, syscall.WSAECONNRESET} // see accept in fd_windows.go
    17  )
    18  
    19  func isPlatformError(err error) bool {
    20  	_, ok := err.(syscall.Errno)
    21  	return ok
    22  }
    23  
    24  func isENOBUFS(err error) bool {
    25  	// syscall.ENOBUFS is a completely made-up value on Windows: we don't expect
    26  	// a real system call to ever actually return it. However, since it is already
    27  	// defined in the syscall package we may as well check for it.
    28  	return errors.Is(err, syscall.ENOBUFS)
    29  }
    30  

View as plain text