Skip to content

Commit

Permalink
locks for fingerprint reads/writes
Browse files Browse the repository at this point in the history
  • Loading branch information
chelseakomlo committed Jan 30, 2018
1 parent ae889b4 commit e8aaa93
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,9 @@ func (c *Client) fingerprint() error {

request := &cstructs.FingerprintRequest{Config: c.config, Node: c.config.Node}
var response cstructs.FingerprintResponse
c.configLock.Lock()
err = f.Fingerprint(request, &response)
c.configLock.Unlock()
if err != nil {
return err
}
Expand Down Expand Up @@ -988,7 +990,9 @@ func (c *Client) fingerprintPeriodic(name string, f fingerprint.Fingerprint, d t
case <-time.After(d):
request := &cstructs.FingerprintRequest{Config: c.config, Node: c.config.Node}
var response cstructs.FingerprintResponse
c.configLock.Lock()
err := f.Fingerprint(request, &response)
c.configLock.Unlock()

if err != nil {
c.logger.Printf("[DEBUG] client: periodic fingerprinting for %v failed: %v", name, err)
Expand Down Expand Up @@ -1036,9 +1040,11 @@ func (c *Client) setupDrivers() error {

request := &cstructs.FingerprintRequest{Config: c.config, Node: c.config.Node}
var response cstructs.FingerprintResponse
c.configLock.Lock()
if err := d.Fingerprint(request, &response); err != nil {
return err
}
c.configLock.Unlock()

c.updateNodeFromFingerprint(&response)

Expand Down

0 comments on commit e8aaa93

Please sign in to comment.