Browse Source

registry: add a critical section to protect authTransport.modReq

Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
lzhfromustc 5 years ago
parent
commit
49fbb9c985
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 {