mirror of
https://github.com/status-im/status-go.git
synced 2025-01-24 13:41:24 +00:00
32 lines
501 B
Go
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
|
|
}
|