/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.util.ResourceUtils
 */
package com.l7tech.server.transport.http;

import com.l7tech.server.transport.http.TimeoutInputStream;
import com.l7tech.server.transport.http.m;
import com.l7tech.util.ResourceUtils;
import java.io.Closeable;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

class n
implements Runnable {
    private Set<m> a = new HashSet<m>(100);
    private static final String[] b;

    private n() {
    }

    private void a(m m2, boolean bl2) {
        if (!bl2) {
            ResourceUtils.closeQuietly((Closeable)m2.h);
        }
        m2.f();
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Loose catch block
     */
    @Override
    public void run() {
        String[] stringArray = b;
        TimeoutInputStream.a.info(stringArray[0]);
        try {
            boolean bl2 = false;
            block21: while (true) {
                block27: {
                    block26: {
                        try {
                            if (bl2) break block26;
                            Thread.sleep(100L);
                            break block27;
                        }
                        catch (InterruptedException interruptedException) {
                            throw n.a(interruptedException);
                        }
                    }
                    Thread.sleep(10L);
                }
                bl2 = false;
                while (true) {
                    m m2 = TimeoutInputStream.e.poll();
                    try {
                        if (m2 == null) break;
                        if (m2.e()) continue;
                    }
                    catch (InterruptedException interruptedException) {
                        throw n.a(interruptedException);
                    }
                    this.a.add(m2);
                    bl2 = true;
                }
                long l2 = System.currentTimeMillis();
                Iterator<m> iterator = this.a.iterator();
                while (true) {
                    boolean[] blArray;
                    m m3;
                    block28: {
                        if (!iterator.hasNext()) continue block21;
                        m3 = iterator.next();
                        try {
                            if (m3.e()) {
                                iterator.remove();
                                continue;
                            }
                        }
                        catch (InterruptedException interruptedException) {
                            throw n.a(interruptedException);
                        }
                        try {
                            if (m3.b(l2)) {
                                TimeoutInputStream.a.fine(b[2]);
                                this.a(m3, false);
                                iterator.remove();
                                continue;
                            }
                        }
                        catch (InterruptedException interruptedException) {
                            throw n.a(interruptedException);
                        }
                        bl2 = true;
                        blArray = new boolean[2];
                        m3.a(l2, blArray);
                        if (!blArray[0]) continue;
                        try {
                            block29: {
                                if (blArray[1]) break block28;
                                break block29;
                                catch (InterruptedException interruptedException) {
                                    throw n.a(interruptedException);
                                }
                            }
                            TimeoutInputStream.a.fine(b[1]);
                        }
                        catch (InterruptedException interruptedException) {
                            throw n.a(interruptedException);
                        }
                    }
                    this.a(m3, blArray[1]);
                    iterator.remove();
                    continue;
                    break;
                }
                break;
            }
        }
        catch (InterruptedException interruptedException) {
            Object object = TimeoutInputStream.f;
            synchronized (object) {
                TimeoutInputStream.h = null;
            }
        }
        catch (Exception exception) {
            Object object = TimeoutInputStream.f;
            synchronized (object) {
                TimeoutInputStream.g = exception;
            }
        }
        TimeoutInputStream.a.info(b[3]);
    }

    private static InterruptedException a(InterruptedException interruptedException) {
        return interruptedException;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[4];
                var3_1 = 0;
                var2_2 = "\u001a^\u0015\u0017\u0005]c!U\u0004\u000fQz~>U\n\u0017\u0005.c;B\u0000\u0003\u0015.d'Q\u0017\u0016\u0018`p}\u001a\u001a\u007fE\u0016\u001ea7 \\\n\u0015].~=D\u0000\u0010\u0003{g'Y\u000b\u0005_";
                var4_3 = "\u001a^\u0015\u0017\u0005]c!U\u0004\u000fQz~>U\n\u0017\u0005.c;B\u0000\u0003\u0015.d'Q\u0017\u0016\u0018`p}\u001a\u001a\u007fE\u0016\u001ea7 \\\n\u0015].~=D\u0000\u0010\u0003{g'Y\u000b\u0005_".length();
                var1_4 = 36;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 72;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block9;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = n.a(v0, n.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "_:\u0000S]&7y\u0000T\u000b\u0014\"<b\u0010RUA;&\u007f\u001bG\t$_\u001bPR@\u0018&d\u0010AJ\u0014?;{\u0010OR@k&~\u0007EFPk!b\u001aPW]%58";
                    var4_3 = "_:\u0000S]&7y\u0000T\u000b\u0014\"<b\u0010RUA;&\u007f\u001bG\t$_\u001bPR@\u0018&d\u0010AJ\u0014?;{\u0010OR@k&~\u0007EFPk!b\u001aPW]%58".length();
                    var1_4 = 25;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 13;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block9;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = n.a(v0, n.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block10;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        n.b = var5;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x5F);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 27;
                    case 1 -> 120;
                    case 2 -> 45;
                    case 3 -> 42;
                    case 4 -> 57;
                    case 5 -> 70;
                    default -> 95;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

