TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

以下内容为反编译后的 d.java 源代码,内容仅作参考


package com.tencent.mobileqq.msf.core.net.b;

import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import com.tencent.mobileqq.msf.core.MsfCore;
import com.tencent.mobileqq.msf.core.NetConnInfoCenter;
import com.tencent.mobileqq.msf.core.r;
import com.tencent.mobileqq.troop.widget.TroopUsageTimeReport;
import com.tencent.qphone.base.remote.ToServiceMsg;
import com.tencent.qphone.base.util.BaseApplication;
import com.tencent.qphone.base.util.QLog;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
public class d {
    private static final String f90506a = "ReqAllFailDetector";
    private static final int f = 10000;
    private static final long g = 180000;
    private CopyOnWriteArrayList f90507b;
    private CopyOnWriteArrayList f90508c;
    private long h;
    private int j;
    private long k;
    private MsfCore m;
    private CopyOnWriteArrayList d = new CopyOnWriteArrayList();
    private AtomicBoolean e = new AtomicBoolean(false);
    private String i = "";
    private String l = "";
    private Handler n = new e(this, Looper.getMainLooper());

    public d(MsfCore msfCore) {
        this.m = msfCore;
        a();
    }

    public void a() {
        try {
            if (com.tencent.mobileqq.msf.core.a.a.av()) {
                this.f90507b = new CopyOnWriteArrayList();
                this.f90508c = new CopyOnWriteArrayList();
                String e = r.e();
                if (e != null) {
                    if (e.startsWith("460") || e.startsWith("461")) {
                        if (e.startsWith("46000") || e.startsWith("46002")) {
                            com.tencent.mobileqq.msf.core.d dVar = new com.tencent.mobileqq.msf.core.d();
                            dVar.c("120.196.210.210");
                            dVar.a(8080);
                            this.f90507b.add(dVar);
                            com.tencent.mobileqq.msf.core.d dVar2 = new com.tencent.mobileqq.msf.core.d();
                            dVar2.c("183.232.95.122");
                            dVar2.a(8080);
                            this.f90507b.add(dVar2);
                        } else if (e.startsWith("46001")) {
                            com.tencent.mobileqq.msf.core.d dVar3 = new com.tencent.mobileqq.msf.core.d();
                            dVar3.c("112.90.82.216");
                            dVar3.a(8080);
                            this.f90507b.add(dVar3);
                            com.tencent.mobileqq.msf.core.d dVar4 = new com.tencent.mobileqq.msf.core.d();
                            dVar4.c("112.90.83.32");
                            dVar4.a(8080);
                            this.f90507b.add(dVar4);
                        } else if (e.startsWith("46003")) {
                            com.tencent.mobileqq.msf.core.d dVar5 = new com.tencent.mobileqq.msf.core.d();
                            dVar5.c("183.60.9.149");
                            dVar5.a(8080);
                            this.f90507b.add(dVar5);
                            com.tencent.mobileqq.msf.core.d dVar6 = new com.tencent.mobileqq.msf.core.d();
                            dVar6.c("183.60.15.152");
                            dVar6.a(8080);
                            this.f90507b.add(dVar6);
                        }
                    }
                    com.tencent.mobileqq.msf.core.d dVar7 = new com.tencent.mobileqq.msf.core.d();
                    dVar7.c("120.196.210.210");
                    dVar7.a(8080);
                    this.f90508c.add(dVar7);
                    com.tencent.mobileqq.msf.core.d dVar8 = new com.tencent.mobileqq.msf.core.d();
                    dVar8.c("183.232.95.122");
                    dVar8.a(8080);
                    this.f90508c.add(dVar8);
                    com.tencent.mobileqq.msf.core.d dVar9 = new com.tencent.mobileqq.msf.core.d();
                    dVar9.c("112.90.82.216");
                    dVar9.a(8080);
                    this.f90508c.add(dVar9);
                    com.tencent.mobileqq.msf.core.d dVar10 = new com.tencent.mobileqq.msf.core.d();
                    dVar10.c("112.90.83.32");
                    dVar10.a(8080);
                    this.f90508c.add(dVar10);
                    com.tencent.mobileqq.msf.core.d dVar11 = new com.tencent.mobileqq.msf.core.d();
                    dVar11.c("183.60.9.149");
                    dVar11.a(8080);
                    this.f90508c.add(dVar11);
                    com.tencent.mobileqq.msf.core.d dVar12 = new com.tencent.mobileqq.msf.core.d();
                    dVar12.c("183.60.15.152");
                    dVar12.a(8080);
                    this.f90508c.add(dVar12);
                    return;
                }
                return;
            }
            this.f90507b = com.tencent.mobileqq.msf.core.a.a.ax();
            this.f90508c = com.tencent.mobileqq.msf.core.a.a.aw();
        } catch (Exception e2) {
            e2.printStackTrace();
            QLog.d(f90506a, 1, "loadConfigEndpoint exception", e2);
        }
    }

    private CopyOnWriteArrayList c() {
        if (NetConnInfoCenter.isWifiConn()) {
            return this.f90508c;
        }
        if (NetConnInfoCenter.isMobileConn()) {
            return this.f90507b;
        }
        return null;
    }

    public void a(ToServiceMsg toServiceMsg) {
        try {
            if (this.e.get() && this.d.size() > 0) {
                int i = 0;
                while (true) {
                    int i2 = i;
                    if (i2 < this.d.size()) {
                        ((f) this.d.get(i2)).a(toServiceMsg);
                        i = i2 + 1;
                    } else {
                        return;
                    }
                }
            }
        } catch (Throwable th) {
            th.printStackTrace();
            QLog.d(f90506a, 1, "onSendRequest exception", th);
        }
    }

    public void a(long j, String str, int i, String str2, long j2) {
        if (!this.e.compareAndSet(false, true)) {
            QLog.d(f90506a, 1, "startReqFailDetect fail by detect running");
            return;
        }
        try {
            QLog.d(f90506a, 1, "startReqFailDetect succ");
            CopyOnWriteArrayList c2 = c();
            if (c2 != null && c2.size() > 0) {
                QLog.d(f90506a, 1, "startReqFailDetect");
                this.n.sendEmptyMessageDelayed(10000, 180000L);
                this.h = j;
                this.i = str;
                this.j = i;
                this.l = str2;
                this.k = j2;
                for (int i2 = 0; i2 < c2.size(); i2++) {
                    f fVar = new f(this.m, (com.tencent.mobileqq.msf.core.d) c2.get(i2), i2);
                    fVar.start();
                    this.d.add(fVar);
                }
                return;
            }
            this.e.set(false);
            QLog.d(f90506a, 1, "stopReqFailDetect by sso empty");
        } catch (Exception e) {
            e.printStackTrace();
            QLog.d(f90506a, 1, "startReqFailDetect fail by except", e);
        }
    }

    public void b() {
        String[] list;
        boolean z = false;
        QLog.d(f90506a, 1, "stopReqFailDetect");
        this.e.set(false);
        try {
            StringBuffer stringBuffer = new StringBuffer();
            Iterator it = this.d.iterator();
            boolean z2 = false;
            boolean z3 = false;
            while (it.hasNext()) {
                f fVar = (f) it.next();
                String b2 = fVar.b();
                fVar.a();
                this.d.remove(fVar);
                if (stringBuffer.length() > 0) {
                    stringBuffer.append("#");
                }
                stringBuffer.append(b2);
                boolean z4 = (!fVar.f90512c || (fVar.f90510a && fVar.f90511b)) ? z3 : true;
                z2 = (!fVar.f90512c || fVar.e <= 30000) ? (!fVar.f90512c || fVar.d <= 30000) ? z2 : true : true;
                z3 = z4;
            }
            HashMap hashMap = new HashMap();
            hashMap.put("host", this.i);
            hashMap.put("port", String.valueOf(this.j));
            hashMap.put(TroopUsageTimeReport.e, String.valueOf(this.l));
            hashMap.put("sendCount", String.valueOf(this.k));
            hashMap.put("connTime", String.valueOf(this.h));
            hashMap.put("detectInfo", stringBuffer.toString());
            File file = new File(Environment.getExternalStorageDirectory().getPath() + "/tencent/" + BaseApplication.getContext().getPackageName().replace(".", "/") + "/");
            if (file.exists() && file.isDirectory() && (list = file.list()) != null && list.length > 0) {
                int length = list.length;
                int i = 0;
                while (true) {
                    if (i >= length) {
                        break;
                    } else if (list[i].endsWith(".pcap")) {
                        z = true;
                        break;
                    } else {
                        i++;
                    }
                }
            }
            if (this.m.statReporter != null) {
                this.m.statReporter.a(com.tencent.mobileqq.msf.core.c.g.ab, z, 0L, 0L, (Map) hashMap, false, false);
                if (z3) {
                    this.m.statReporter.a(com.tencent.mobileqq.msf.core.c.g.ac, z, 0L, 0L, (Map) hashMap, false, false);
                }
                if (z2) {
                    this.m.statReporter.a(com.tencent.mobileqq.msf.core.c.g.ad, z, 0L, 0L, (Map) hashMap, false, false);
                }
            }
        } catch (Throwable th) {
            th.printStackTrace();
            QLog.d(f90506a, 1, "stopReqFailDetect exception", th);
        }
    }
}