Protect http client cache with mutex
This commit is contained in:
parent
3329f1d49d
commit
b6f74b66d5
@ -46,6 +46,7 @@ type FetchPruneConfig struct {
|
||||
type Configuration struct {
|
||||
CurrentRemote string
|
||||
httpClients map[string]*HttpClient
|
||||
httpClientsMutex sync.Mutex
|
||||
redirectingHttpClient *http.Client
|
||||
ntlmSession ntlm.ClientSession
|
||||
envVars map[string]string
|
||||
|
@ -100,6 +100,9 @@ func (c *HttpClient) Do(req *http.Request) (*http.Response, error) {
|
||||
|
||||
// HttpClient returns a new HttpClient for the given host (which may be "host:port")
|
||||
func (c *Configuration) HttpClient(host string) *HttpClient {
|
||||
c.httpClientsMutex.Lock()
|
||||
defer c.httpClientsMutex.Unlock()
|
||||
|
||||
if c.httpClients == nil {
|
||||
c.httpClients = make(map[string]*HttpClient)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user