Fixes for comments

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2019-03-25 11:48:22 -07:00
parent bacb73a403
commit 92f9f7ed56
3 changed files with 7 additions and 10 deletions

View File

@@ -536,17 +536,13 @@ func (s *Server) isLeafNodeAuthorized(c *client) bool {
// Grab under lock but process after.
var (
opts *Options
juc *jwt.UserClaims
acc *Account
err error
juc *jwt.UserClaims
acc *Account
err error
)
s.mu.Lock()
// Grab options
opts = s.opts
// Check if we have trustedKeys defined in the server. If so we require a user jwt.
if s.trustedKeys != nil {
if c.opts.JWT == "" {
@@ -617,7 +613,6 @@ func (s *Server) isLeafNodeAuthorized(c *client) bool {
// Generate a connect event if we have a system account.
// FIXME(dlc) - Make one for leafnodes if we track active connections.
//s.accountConnectEvent(c)
// Check if we need to set an auth timer if the user jwt expires.
c.checkExpiration(juc.Claims())
@@ -625,10 +620,11 @@ func (s *Server) isLeafNodeAuthorized(c *client) bool {
}
// Snapshot server options.
opts := s.getOpts()
if opts.LeafNode.Username == "" {
return true
}
if opts.LeafNode.Username != c.opts.Username {
return false
}

View File

@@ -925,7 +925,7 @@ func parseGateway(v interface{}, o *Options, errors *[]error, warnings *[]error)
return nil
}
// parseCluster will parse the cluster config.
// parseLeafNodes will parse the leaf node config.
func parseLeafNodes(v interface{}, opts *Options, errors *[]error, warnings *[]error) error {
tk, v := unwrapValue(v)
cm, ok := v.(map[string]interface{})

View File

@@ -710,6 +710,7 @@ func (s *Server) registerAccount(acc *Account) {
// already created (global account), so use locking and
// make sure we create only if needed.
acc.mu.Lock()
// TODO(dlc)- Double check that we need this for GWs.
if acc.rm == nil && s.opts != nil && s.shouldTrackSubscriptions() {
acc.rm = make(map[string]int32)
}