فهرست منبع

etcdserver, auth: remove obsolete mutex

The removed mutex is obsolete because the enabled field is removed
in the commit b2d2c79a2fcb20f6c64eeb95d1e7d1ddbcd453b1.
Hitoshi Mitake 10 سال پیش
والد
کامیت
0cf9cde1b4
1فایلهای تغییر یافته به همراه0 افزوده شده و 12 حذف شده
  1. 0 12
      etcdserver/auth/auth.go

+ 0 - 12
etcdserver/auth/auth.go

@@ -23,7 +23,6 @@ import (
 	"reflect"
 	"reflect"
 	"sort"
 	"sort"
 	"strings"
 	"strings"
-	"sync"
 	"time"
 	"time"
 
 
 	"github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/pkg/capnslog"
 	"github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/pkg/capnslog"
@@ -102,8 +101,6 @@ type store struct {
 	timeout     time.Duration
 	timeout     time.Duration
 	ensuredOnce bool
 	ensuredOnce bool
 
 
-	mu sync.Mutex // protect enabled
-
 	PasswordStore
 	PasswordStore
 }
 }
 
 
@@ -409,9 +406,6 @@ func (s *store) UpdateRole(role Role) (Role, error) {
 }
 }
 
 
 func (s *store) AuthEnabled() bool {
 func (s *store) AuthEnabled() bool {
-	s.mu.Lock()
-	defer s.mu.Unlock()
-
 	return s.detectAuth()
 	return s.detectAuth()
 }
 }
 
 
@@ -420,9 +414,6 @@ func (s *store) EnableAuth() error {
 		return authErr(http.StatusConflict, "already enabled")
 		return authErr(http.StatusConflict, "already enabled")
 	}
 	}
 
 
-	s.mu.Lock()
-	defer s.mu.Unlock()
-
 	if _, err := s.GetUser("root"); err != nil {
 	if _, err := s.GetUser("root"); err != nil {
 		return authErr(http.StatusConflict, "No root user available, please create one")
 		return authErr(http.StatusConflict, "No root user available, please create one")
 	}
 	}
@@ -448,9 +439,6 @@ func (s *store) DisableAuth() error {
 		return authErr(http.StatusConflict, "already disabled")
 		return authErr(http.StatusConflict, "already disabled")
 	}
 	}
 
 
-	s.mu.Lock()
-	defer s.mu.Unlock()
-
 	err := s.disableAuth()
 	err := s.disableAuth()
 	if err == nil {
 	if err == nil {
 		plog.Noticef("auth: disabled auth")
 		plog.Noticef("auth: disabled auth")