github.com/neatlab/neatio@v1.7.3-0.20220425043230-d903e92fcc75/network/p2p/netutil/toobig_windows.go (about)

     1  //go:build windows
     2  // +build windows
     3  
     4  package netutil
     5  
     6  import (
     7  	"net"
     8  	"os"
     9  	"syscall"
    10  )
    11  
    12  const _WSAEMSGSIZE = syscall.Errno(10040)
    13  
    14  func isPacketTooBig(err error) bool {
    15  	if opErr, ok := err.(*net.OpError); ok {
    16  		if scErr, ok := opErr.Err.(*os.SyscallError); ok {
    17  			return scErr.Err == _WSAEMSGSIZE
    18  		}
    19  		return opErr.Err == _WSAEMSGSIZE
    20  	}
    21  	return false
    22  }