diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-06-26 22:07:29 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-06-26 22:07:29 +0200 |
commit | eb75ff430d1f78e129bbfe49d612f241ca418df4 (patch) | |
tree | ca9a786c1df51c1404001555b1c1c9d425d0b614 /src/keypair.go | |
parent | 9d806d3853c926df75e83966d2c4f832708a1b08 (diff) |
Begin implementation of outbound work queue
Diffstat (limited to 'src/keypair.go')
-rw-r--r-- | src/keypair.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/keypair.go b/src/keypair.go index e7961a8..53e123f 100644 --- a/src/keypair.go +++ b/src/keypair.go @@ -16,6 +16,18 @@ type KeyPairs struct { mutex sync.RWMutex current *KeyPair previous *KeyPair - next *KeyPair - newKeyPair chan bool + next *KeyPair // not yet "confirmed by transport" + newKeyPair chan bool // signals when "current" has been updated +} + +func (kp *KeyPairs) Init() { + kp.mutex.Lock() + kp.newKeyPair = make(chan bool, 5) + kp.mutex.Unlock() +} + +func (kp *KeyPairs) Current() *KeyPair { + kp.mutex.RLock() + defer kp.mutex.RUnlock() + return kp.current } |