Skip to content

Commit

Permalink
Naming consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
dim committed Mar 30, 2015
1 parent e428ae1 commit ac45713
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type ClusterClient struct {
slots [][]string
slotsMx sync.RWMutex // protects slots & addrs cache

conns map[string]*Client
connMx sync.Mutex // protects conns
conns map[string]*Client
connsMx sync.Mutex // protects conns

opt *ClusterOptions

Expand Down Expand Up @@ -65,15 +65,15 @@ func (c *ClusterClient) getMasterAddrBySlot(hashSlot int) string {

// Returns a node's client for a given address
func (c *ClusterClient) getNodeClientByAddr(addr string) *Client {
c.connMx.Lock()
c.connsMx.Lock()
client, ok := c.conns[addr]
if !ok {
opt := c.opt.clientOptions()
opt.Addr = addr
client = NewTCPClient(opt)
c.conns[addr] = client
}
c.connMx.Unlock()
c.connsMx.Unlock()
return client
}

Expand Down Expand Up @@ -170,14 +170,14 @@ func (c *ClusterClient) reloadIfDue() (err error) {

// Closes all connections and flushes slots cache
func (c *ClusterClient) reset() (err error) {
c.connMx.Lock()
c.connsMx.Lock()
for addr, client := range c.conns {
if e := client.Close(); e != nil {
err = e
}
delete(c.conns, addr)
}
c.connMx.Unlock()
c.connsMx.Unlock()
c.slots = make([][]string, hashSlots)
return
}
Expand Down

0 comments on commit ac45713

Please sign in to comment.