Improved timer state machine
This commit is contained in:
parent
5c1ccbddf0
commit
4ad62aaa6a
10 changed files with 418 additions and 222 deletions
|
|
@ -23,19 +23,6 @@ type KeyPairs struct {
|
|||
next *KeyPair // not yet "confirmed by transport"
|
||||
}
|
||||
|
||||
/* Called during recieving to confirm the handshake
|
||||
* was completed correctly
|
||||
*/
|
||||
func (kp *KeyPairs) Used(key *KeyPair) {
|
||||
if key == kp.next {
|
||||
kp.mutex.Lock()
|
||||
kp.previous = kp.current
|
||||
kp.current = key
|
||||
kp.next = nil
|
||||
kp.mutex.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
func (kp *KeyPairs) Current() *KeyPair {
|
||||
kp.mutex.RLock()
|
||||
defer kp.mutex.RUnlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue