mirror of
https://github.com/gusaul/grpcox.git
synced 2025-01-24 05:04:39 +00:00
add mutex to append conn to map to avoid concurrent map access
This commit is contained in:
parent
6148904bec
commit
3908c00c11
|
@ -121,7 +121,9 @@ func (c *ConnStore) addConnection(host string, res *Resource, ttl ...time.Durati
|
|||
conn.expired = time.Now().Add(ttl[0])
|
||||
}
|
||||
|
||||
c.Lock()
|
||||
c.conn[host] = conn
|
||||
c.Unlock()
|
||||
}
|
||||
|
||||
func (c *ConnStore) getConnection(host string) (res *Resource, found bool) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user