github.com/evdatsion/aphelion-dpos-bft@v0.32.1/privval/utils.go (about)

     1  package privval
     2  
     3  import (
     4  	cmn "github.com/evdatsion/aphelion-dpos-bft/libs/common"
     5  )
     6  
     7  // IsConnTimeout returns a boolean indicating whether the error is known to
     8  // report that a connection timeout occurred. This detects both fundamental
     9  // network timeouts, as well as ErrConnTimeout errors.
    10  func IsConnTimeout(err error) bool {
    11  	if cmnErr, ok := err.(cmn.Error); ok {
    12  		if cmnErr.Data() == ErrConnTimeout {
    13  			return true
    14  		}
    15  	}
    16  	if _, ok := err.(timeoutError); ok {
    17  		return true
    18  	}
    19  	return false
    20  }