Begin implementation of outbound work queue
This commit is contained in:
parent
9d806d3853
commit
eb75ff430d
6 changed files with 181 additions and 84 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue