Files
wireguard-go/src/misc.go
T

35 lines
398 B
Go
Raw Normal View History

2017-05-30 22:36:49 +02:00
package main
2017-07-01 23:29:22 +02:00
import (
"time"
)
2017-05-30 22:36:49 +02:00
func min(a uint, b uint) uint {
if a > b {
return b
}
return a
}
2017-06-30 14:41:08 +02:00
func sendSignal(c chan struct{}) {
select {
case c <- struct{}{}:
default:
}
}
2017-07-01 23:29:22 +02:00
func stopTimer(timer *time.Timer) {
if !timer.Stop() {
select {
case <-timer.C:
default:
}
}
}
func stoppedTimer() *time.Timer {
timer := time.NewTimer(time.Hour)
stopTimer(timer)
return timer
}