package h;

import java.io.IOException;

/* JADX INFO: loaded from: classes.dex */
public class b implements x {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ x f6517b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ c f6518c;

    public b(c cVar, x xVar) {
        this.f6518c = cVar;
        this.f6517b = xVar;
    }

    @Override // h.x, java.io.Closeable, java.lang.AutoCloseable
    public void close() throws IOException {
        try {
            try {
                this.f6517b.close();
                this.f6518c.j(true);
            } catch (IOException e2) {
                c cVar = this.f6518c;
                if (!cVar.k()) {
                    throw e2;
                }
                throw cVar.l(e2);
            }
        } catch (Throwable th) {
            this.f6518c.j(false);
            throw th;
        }
    }

    @Override // h.x
    public y e() {
        return this.f6518c;
    }

    public String toString() {
        StringBuilder sbC = a.b.c.a.a.C("AsyncTimeout.source(");
        sbC.append(this.f6517b);
        sbC.append(")");
        return sbC.toString();
    }

    @Override // h.x
    public long v(f fVar, long j2) throws IOException {
        this.f6518c.i();
        try {
            try {
                long jV = this.f6517b.v(fVar, j2);
                this.f6518c.j(true);
                return jV;
            } catch (IOException e2) {
                c cVar = this.f6518c;
                if (cVar.k()) {
                    throw cVar.l(e2);
                }
                throw e2;
            }
        } catch (Throwable th) {
            this.f6518c.j(false);
            throw th;
        }
    }
}
