package okio;

import io.netty.handler.codec.rtsp.RtspHeaders;
import java.io.IOException;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import kotlin.Metadata;
import kotlin.jvm.internal.o;
import kotlin.reflect.w.internal.y0.n.c2.c;

/* JADX INFO: renamed from: z.w, reason: from Kotlin metadata */
/* JADX INFO: loaded from: classes2.dex */
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\b\u0002\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0012\u0010\u0005\u001a\u00020\u00062\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006H\u0014J\b\u0010\b\u001a\u00020\tH\u0014R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\n"}, d2 = {"Lokio/SocketAsyncTimeout;", "Lokio/AsyncTimeout;", "socket", "Ljava/net/Socket;", "(Ljava/net/Socket;)V", "newTimeoutException", "Ljava/io/IOException;", "cause", "timedOut", "", "okio"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final class SocketAsyncTimeout extends AsyncTimeout {

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public final Socket f10162l;

    public SocketAsyncTimeout(Socket socket) {
        o.f(socket, "socket");
        this.f10162l = socket;
    }

    @Override // okio.AsyncTimeout
    public IOException j(IOException iOException) {
        SocketTimeoutException socketTimeoutException = new SocketTimeoutException(RtspHeaders.Values.TIMEOUT);
        if (iOException != null) {
            socketTimeoutException.initCause(iOException);
        }
        return socketTimeoutException;
    }

    @Override // okio.AsyncTimeout
    public void k() {
        Level level;
        StringBuilder sb;
        Logger logger;
        Throwable th;
        try {
            this.f10162l.close();
        } catch (AssertionError e2) {
            if (!c.a0(e2)) {
                throw e2;
            }
            Logger logger2 = n.a;
            level = Level.WARNING;
            sb = new StringBuilder();
            th = e2;
            logger = logger2;
            sb.append("Failed to close timed out socket ");
            sb.append(this.f10162l);
            logger.log(level, sb.toString(), th);
        } catch (Exception e3) {
            Logger logger3 = n.a;
            level = Level.WARNING;
            sb = new StringBuilder();
            th = e3;
            logger = logger3;
            sb.append("Failed to close timed out socket ");
            sb.append(this.f10162l);
            logger.log(level, sb.toString(), th);
        }
    }
}
