contentproxy: ensure grpc stream is closed on commit
@@ -97,7 +97,14 @@ func (rw *remoteWriter) Write(p []byte) (n int, err error) {
return
}
-func (rw *remoteWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) error {
+func (rw *remoteWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) (err error) {
+ defer func() {
+ err1 := rw.Close()
+ if err == nil {
+ err = err1
+ }
+ }()
+
var base content.Info
for _, opt := range opts {
if err := opt(&base); err != nil {
