github.com/bytom/bytom@v1.1.2-0.20221014091027-bbcba3df6075/p2p/netutil/error.go (about)

     1  package netutil
     2  
     3  // isPacketTooBig reports whether err indicates that a UDP packet didn't
     4  // fit the receive buffer. There is no such error on
     5  // non-Windows platforms.
     6  func isPacketTooBig(err error) bool {
     7  	return false
     8  }
     9  
    10  // IsTemporaryError checks whether the given error should be considered temporary.
    11  func IsTemporaryError(err error) bool {
    12  	tempErr, ok := err.(interface {
    13  		Temporary() bool
    14  	})
    15  	return ok && tempErr.Temporary() || isPacketTooBig(err)
    16  }