package p138.p329.p362.p370;

import com.hierynomus.mssmb2.SMBApiException;
import com.hierynomus.protocol.transport.TransportException;
import com.hierynomus.smbj.common.SMBRuntimeException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import p138.p176.p177.p242.p246.p251.C4303;
import p138.p329.p341.EnumC6158;
import p138.p329.p346.C6228;
import p138.p329.p346.C6231;
import p138.p329.p346.C6237;
import p138.p329.p346.EnumC6222;
import p138.p329.p346.p347.C6245;
import p138.p329.p346.p347.C6271;
import p138.p329.p351.p352.p354.InterfaceC6301;
import p138.p329.p362.C6340;
import p138.p329.p362.p364.C6353;
import p138.p329.p362.p365.C6354;
import p138.p329.p362.p365.C6358;
import p138.p329.p362.p366.C6369;
import p138.p329.p362.p367.C6373;
import p138.p329.p362.p369.C6386;
import p421.p422.p423.p424.C6713;

/* JADX INFO: renamed from: ދ.ށ.މ.މ.ވ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C6406 implements AutoCloseable {

    /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
    public static final C6228 f17880 = new C6228(new byte[]{-1, -1, -1, -1, -1, -1, -1, -1}, new byte[]{-1, -1, -1, -1, -1, -1, -1, -1});

    /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
    public static final InterfaceC6411 f17881 = new C6407();

    /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
    public static final InterfaceC6411 f17882 = new C6408();

    /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
    public static final InterfaceC6411 f17883 = new C6410();

    /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
    public static final C6373 f17884 = new C6373(0);

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final C6353 f17885;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final C6413 f17886;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final long f17887;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public C6386 f17888;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final EnumC6222 f17889;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final int f17890;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final long f17891;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public final int f17892;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public final long f17893;

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public final int f17894;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public final long f17895;

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public final long f17896;

    /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
    public final AtomicBoolean f17897 = new AtomicBoolean(false);

    /* JADX INFO: renamed from: ދ.ށ.މ.މ.ވ$֏, reason: contains not printable characters */
    public class C6407 implements InterfaceC6411 {
        @Override // p138.p329.p362.p370.InterfaceC6411
        /* JADX INFO: renamed from: ֏ */
        public boolean mo9604(long j) {
            return j == EnumC6158.STATUS_SUCCESS.f17193 || j == EnumC6158.STATUS_STOPPED_ON_SYMLINK.f17193;
        }
    }

    /* JADX INFO: renamed from: ދ.ށ.މ.މ.ވ$ؠ, reason: contains not printable characters */
    public class C6408 implements InterfaceC6411 {
        @Override // p138.p329.p362.p370.InterfaceC6411
        /* JADX INFO: renamed from: ֏ */
        public boolean mo9604(long j) {
            return j == EnumC6158.STATUS_SUCCESS.f17193 || j == EnumC6158.STATUS_NO_MORE_FILES.f17193 || j == EnumC6158.STATUS_NO_SUCH_FILE.f17193;
        }
    }

    /* JADX INFO: renamed from: ދ.ށ.މ.މ.ވ$ހ, reason: contains not printable characters */
    public class C6409 implements InterfaceC6411 {
        @Override // p138.p329.p362.p370.InterfaceC6411
        /* JADX INFO: renamed from: ֏ */
        public boolean mo9604(long j) {
            return j == EnumC6158.STATUS_SUCCESS.f17193 || j == EnumC6158.STATUS_END_OF_FILE.f17193;
        }
    }

    /* JADX INFO: renamed from: ދ.ށ.މ.މ.ވ$ށ, reason: contains not printable characters */
    public class C6410 implements InterfaceC6411 {
        @Override // p138.p329.p362.p370.InterfaceC6411
        /* JADX INFO: renamed from: ֏ */
        public boolean mo9604(long j) {
            return j == EnumC6158.STATUS_SUCCESS.f17193 || j == EnumC6158.STATUS_FILE_CLOSED.f17193;
        }
    }

    public C6406(C6353 c6353, C6413 c6413) {
        this.f17885 = c6353;
        this.f17886 = c6413;
        this.f17888 = c6413.f17901;
        C6354 c6354 = c6413.f17902;
        C6358 c6358 = c6354.f17739.f17759;
        this.f17889 = c6358.f17764;
        C6340 c6340 = c6354.f17747;
        this.f17890 = Math.min(c6340.f17700, c6358.f17766);
        this.f17891 = c6340.f17701;
        this.f17892 = Math.min(c6340.f17702, c6358.f17767);
        this.f17893 = c6340.f17703;
        this.f17894 = Math.min(c6340.f17704, c6358.f17765);
        this.f17895 = c6340.f17706;
        this.f17896 = this.f17888.f17825;
        this.f17887 = c6413.f17899;
    }

    @Override // java.lang.AutoCloseable
    public void close() {
        if (this.f17897.getAndSet(true)) {
            return;
        }
        C6413 c6413 = this.f17886;
        if (c6413 == null) {
            throw null;
        }
        try {
            C6237 c6237 = (C6237) C4303.m7011(c6413.f17901.m9606(new C6271(c6413.f17902.f17739.f17759.f17764, c6413.f17901.f17825, c6413.f17899)), c6413.f17902.f17747.f17706, TimeUnit.MILLISECONDS, TransportException.f2172);
            if (EnumC6158.m9480(c6237.mo9556().f17394)) {
                return;
            }
            throw new SMBApiException(c6237.mo9556(), "Error closing connection to " + c6413.f17900);
        } finally {
            ((C6713) c6413.f17903.f17784).m9911(new C6369(c6413.f17901.f17825, c6413.f17899));
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final <T extends C6237> Future<T> m9633(C6237 c6237) {
        if (!this.f17897.get()) {
            try {
                return this.f17888.m9606(c6237);
            } catch (TransportException e) {
                throw new SMBRuntimeException(e);
            }
        }
        throw new SMBRuntimeException(getClass().getSimpleName() + " has already been closed");
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final <T extends C6237> T m9634(C6237 c6237, String str, Object obj, InterfaceC6411 interfaceC6411, long j) {
        Future<T> futureM9633 = m9633(c6237);
        try {
            T t = j > 0 ? (T) C4303.m7011(futureM9633, j, TimeUnit.MILLISECONDS, TransportException.f2172) : (T) C4303.m7012((Future) futureM9633, (InterfaceC6301) TransportException.f2172);
            if (interfaceC6411.mo9604(((C6231) t.mo9556()).f17394)) {
                return t;
            }
            throw new SMBApiException((C6231) t.mo9556(), str + " failed for " + obj);
        } catch (TransportException e) {
            throw new SMBRuntimeException(e);
        }
    }

    /* JADX INFO: renamed from: ֏ */
    public InterfaceC6411 mo9622() {
        return f17881;
    }

    /* JADX INFO: renamed from: ֏ */
    public void mo9631(C6228 c6228) {
        m9634(new C6245(this.f17889, this.f17896, this.f17887, c6228), "Close", c6228, f17883, this.f17895);
    }
}
