Skip to content

Commit

Permalink
Add comments to hasNodeChanged and remove superfluous else block
Browse files Browse the repository at this point in the history
  • Loading branch information
iverberk committed Feb 4, 2016
1 parent 035cc02 commit a788360
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,10 @@ func (c *Client) run() {
}
}

// hasNodeChanged calculates a hash for the node attributes- and meta map.
// The new hash values are compared against the old (passed-in) hash values to
// determine if the node properties have changed. It returns the new hash values
// in case they are different from the old hash values.
func (c *Client) hasNodeChanged(oldAttrHash uint64, oldMetaHash uint64) (bool, uint64, uint64) {
newAttrHash, err := hashstructure.Hash(c.config.Node.Attributes, nil)
if err != nil {
Expand All @@ -668,9 +672,8 @@ func (c *Client) hasNodeChanged(oldAttrHash uint64, oldMetaHash uint64) (bool, u
}
if newAttrHash != oldAttrHash || newMetaHash != oldMetaHash {
return true, newAttrHash, newMetaHash
} else {
return false, oldAttrHash, oldMetaHash
}
return false, oldAttrHash, oldMetaHash
}

// retryRegisterNode is used to register the node or update the registration and
Expand Down

0 comments on commit a788360

Please sign in to comment.