when deploy registry as a pull through cache ,function copeContent() may cause a socket leak when docker user canceled its pull operation.

Signed-off-by: yaoyao.xyy <yaoyao.xyy@alibaba-inc.com>
This commit is contained in:
yaoyao.xyy 2016-08-02 11:10:10 +08:00
parent 87917f3052
commit 64c8dd3252

View File

@ -55,6 +55,8 @@ func (pbs *proxyBlobStore) copyContent(ctx context.Context, dgst digest.Digest,
return distribution.Descriptor{}, err return distribution.Descriptor{}, err
} }
defer remoteReader.Close()
_, err = io.CopyN(writer, remoteReader, desc.Size) _, err = io.CopyN(writer, remoteReader, desc.Size)
if err != nil { if err != nil {
return distribution.Descriptor{}, err return distribution.Descriptor{}, err