Browse code

registry: add a critical section to protect authTransport.modReq

Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>

lzhfromustc authored on 2019/10/28 08:57:15
Showing 1 changed files
... ...
@@ -133,7 +133,9 @@ func (tr *authTransport) RoundTrip(orig *http.Request) (*http.Response, error) {
133 133
 	}
134 134
 	resp, err := tr.RoundTripper.RoundTrip(req)
135 135
 	if err != nil {
136
+		tr.mu.Lock()
136 137
 		delete(tr.modReq, orig)
138
+		tr.mu.Unlock()
137 139
 		return nil, err
138 140
 	}
139 141
 	if len(resp.Header["X-Docker-Token"]) > 0 {