device: fix comment typo and shorten state.mu.Lock to state.Lock
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -52,7 +52,7 @@ type Peer struct {
|
||||
}
|
||||
|
||||
state struct {
|
||||
mu sync.Mutex // protects against concurrent Start/Stop
|
||||
sync.Mutex // protects against concurrent Start/Stop
|
||||
}
|
||||
|
||||
queue struct {
|
||||
@@ -161,8 +161,8 @@ func (peer *Peer) Start() {
|
||||
}
|
||||
|
||||
// prevent simultaneous start/stop operations
|
||||
peer.state.mu.Lock()
|
||||
defer peer.state.mu.Unlock()
|
||||
peer.state.Lock()
|
||||
defer peer.state.Unlock()
|
||||
|
||||
if peer.isRunning.Get() {
|
||||
return
|
||||
@@ -242,8 +242,8 @@ func (peer *Peer) ExpireCurrentKeypairs() {
|
||||
}
|
||||
|
||||
func (peer *Peer) Stop() {
|
||||
peer.state.mu.Lock()
|
||||
defer peer.state.mu.Unlock()
|
||||
peer.state.Lock()
|
||||
defer peer.state.Unlock()
|
||||
|
||||
if !peer.isRunning.Swap(false) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user