From 767c5283a28f68751c3003bc7dec4f43338020af Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Mon, 1 Jun 2015 13:25:18 -0700 Subject: [PATCH] Fix race condition in registry/session Signed-off-by: Alexander Morozov --- docs/session.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/session.go b/docs/session.go index 71b27bef..22702108 100644 --- a/docs/session.go +++ b/docs/session.go @@ -98,7 +98,11 @@ func (tr *authTransport) RoundTrip(orig *http.Request) (*http.Response, error) { } resp.Body = &transport.OnEOFReader{ Rc: resp.Body, - Fn: func() { delete(tr.modReq, orig) }, + Fn: func() { + tr.mu.Lock() + delete(tr.modReq, orig) + tr.mu.Unlock() + }, } return resp, nil }