ipld-eth-server/vendor/github.com/libp2p/go-yamux/util.go
Elizabeth Engelman 36533f7c3f Update vendor directory and make necessary code changes
Fixes for new geth version
2019-09-25 16:32:27 -05:00

32 lines
501 B
Go

package yamux
// asyncSendErr is used to try an async send of an error
func asyncSendErr(ch chan error, err error) {
if ch == nil {
return
}
select {
case ch <- err:
default:
}
}
// asyncNotify is used to signal a waiting goroutine
func asyncNotify(ch chan struct{}) {
select {
case ch <- struct{}{}:
default:
}
}
// min computes the minimum of a set of values
func min(values ...uint32) uint32 {
m := values[0]
for _, v := range values[1:] {
if v < m {
m = v
}
}
return m
}