Browse Source

storage/watchable_store: defer to Unlock s.mu

New PR from https://github.com/coreos/etcd/pull/3575.
This add `defer` to `s.mu`. Current code does not `Unlock`
in the correct scope, I think.

(Sorry, I accidentally deleted my fork so the changes
might not sound continuous from my previous pull requests.)
Gyu-Ho Lee 10 years ago
parent
commit
4113509828
1 changed files with 1 additions and 1 deletions
  1. 1 1
      storage/watchable_store.go

+ 1 - 1
storage/watchable_store.go

@@ -177,7 +177,7 @@ func (s *watchableStore) Watcher(key []byte, prefix bool, startRev, endRev int64
 
 
 	cancel := CancelFunc(func() {
 	cancel := CancelFunc(func() {
 		s.mu.Lock()
 		s.mu.Lock()
-		s.mu.Unlock()
+		defer s.mu.Unlock()
 		wa.stopWithError(ErrCanceled)
 		wa.stopWithError(ErrCanceled)
 
 
 		// remove global references of the watcher
 		// remove global references of the watcher