Handshake negotiation functioning
This commit is contained in:
parent
a4cc0a30fa
commit
1e620427bd
10 changed files with 512 additions and 82 deletions
19
src/misc.go
19
src/misc.go
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue