client: fix race accessing Node.status

* Call Node.Canonicalize once when Node is created.
 * Lock when accessing fields mutated by node update goroutine
This commit is contained in:
Michael Schurter
2020-02-06 13:37:42 -08:00
parent 729e0c20a5
commit b1f443500d
2 changed files with 10 additions and 4 deletions

View File

@@ -521,6 +521,9 @@ func convertClientConfig(agentConfig *Config) (*clientconfig.Config, error) {
// Set up the HTTP advertise address
conf.Node.HTTPAddr = agentConfig.AdvertiseAddrs.HTTP
// Canonicalize Node struct
conf.Node.Canonicalize()
// Reserve resources on the node.
// COMPAT(0.10): Remove in 0.10
r := conf.Node.Reserved