Handshake negotiation functioning

This commit is contained in:
Mathias Hall-Andersen
2017-07-01 23:29:22 +02:00
parent a4cc0a30fa
commit 1e620427bd
10 changed files with 512 additions and 82 deletions
+19
View File
@@ -1,5 +1,9 @@
package main
import (
"time"
)
func min(a uint, b uint) uint {
if a > b {
return b
@@ -13,3 +17,18 @@ func sendSignal(c chan struct{}) {
default:
}
}
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
}