1
0
mirror of https://github.com/gusaul/grpcox.git synced 2024-09-29 04:10:39 +00:00

Merge pull request #19 from gusaul/aul_add_connection_mutex

add mutex to append conn to map to avoid concurrent map access
This commit is contained in:
Muhammad Auliya 2020-05-29 08:16:08 +07:00 committed by GitHub
commit 30fef12ac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {