Browse Source

Merge pull request #40143 from lzhfromustc/IFP_modReq

registry: add a critical section to protect authTransport.modReq
Tõnis Tiigi 5 years ago
parent
commit
fee149e723
1 changed files with 2 additions and 0 deletions
  1. 2 0
      registry/session.go

+ 2 - 0
registry/session.go

@@ -133,7 +133,9 @@ func (tr *authTransport) RoundTrip(orig *http.Request) (*http.Response, error) {
 	}
 	resp, err := tr.RoundTripper.RoundTrip(req)
 	if err != nil {
+		tr.mu.Lock()
 		delete(tr.modReq, orig)
+		tr.mu.Unlock()
 		return nil, err
 	}
 	if len(resp.Header["X-Docker-Token"]) > 0 {