龙将斩千 v5.5.5.39856版本的 MD5 值为:5c05b1d6f8d872ca3fe0343d6ff07caf
以下内容为反编译后的 c.java 源代码,内容仅作参考
package com.qiyukf.nimlib.net.a.b.a;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import ch.qos.logback.core.CoreConstants;
import com.qiyukf.nimlib.e.g;
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;
public final class c {
private static c g = new c();
private d a;
private long c;
private long d;
private boolean b = true;
private Handler e = com.qiyukf.nimlib.d.b.a.c().a();
private AtomicBoolean f = new AtomicBoolean(false);
public static c a() {
return g;
}
private c() {
a(true);
}
private void a(boolean z) {
String[] strArr;
String[] a = b.a(com.qiyukf.nimlib.c.d(), com.qiyukf.nimlib.net.a.b.d.a.a);
String e = g.e();
if (!TextUtils.isEmpty(e)) {
strArr = new String[]{e};
} else {
strArr = null;
}
this.a = new d(a, strArr);
StringBuilder sb = new StringBuilder();
sb.append(z ? "load cached nos upload server addresses from SP" : "update nos upload server addresses from lbs");
sb.append(", ip count=");
sb.append(this.a.c());
sb.append(", default ip count=");
sb.append(this.a.b());
com.qiyukf.nimlib.j.b.c("NOS_LBS", sb.toString());
}
public final synchronized void b() {
Context d = com.qiyukf.nimlib.c.d();
com.qiyukf.nimlib.j.b.c("NOS_LBS", "fetch NOS LBS on SDK init...");
this.b = true;
b.d(d);
b(false);
b.a(d);
}
public final synchronized String[] c() {
String[] a;
a = this.a.a();
boolean z = (!com.qiyukf.nimlib.c.g().preLoadServers && this.a.c() <= 0) || a.length == 0;
if (this.a.c() == 0) {
b(z);
}
if (z) {
a = this.a.a();
}
return a;
}
public final synchronized void d() {
if (System.currentTimeMillis() - this.d >= 300000) {
this.b = true;
com.qiyukf.nimlib.j.b.c("NOS_LBS", "nos lbs reset all, should fetch nos lbs...");
b(false);
this.d = System.currentTimeMillis();
}
}
private void b(final boolean z) {
if (z || this.b || System.currentTimeMillis() - this.c >= CoreConstants.MILLIS_IN_ONE_HOUR) {
Runnable runnable = new Runnable() {
@Override
public final void run() {
c.this.c(z);
}
};
if (z) {
runnable.run();
} else if (!this.f.get()) {
this.e.post(runnable);
this.f.set(true);
}
}
}
public void c(boolean z) {
StringBuilder sb = new StringBuilder("fetch nos upload server addresses from lbs ");
sb.append(z ? "now" : "on background");
com.qiyukf.nimlib.j.b.c("NOS_LBS", sb.toString());
e();
if (!this.b) {
this.c = System.currentTimeMillis();
}
if (!z) {
this.f.set(false);
}
}
private boolean e() {
boolean z;
String c;
Context d = com.qiyukf.nimlib.c.d();
b.b(d);
int i = 0;
try {
c = b.c(d);
if (!TextUtils.isEmpty(c)) {
z = a(c);
} else {
z = false;
}
} catch (Exception e) {
e = e;
z = false;
}
try {
if (!TextUtils.isEmpty(c) && z) {
return z;
}
String str = com.qiyukf.nimlib.c.i() == null ? null : com.qiyukf.nimlib.c.i().nosUploadLbs;
if (TextUtils.isEmpty(str)) {
str = "https://wanproxy-hz.127.net/lbs";
}
if (TextUtils.isEmpty(str)) {
return z;
}
String[] split = str.split(";");
int length = split.length;
while (i < length) {
boolean a = a(split[i]);
if (!a) {
i++;
z = a;
} else {
return a;
}
}
return z;
} catch (Exception e2) {
e = e2;
com.qiyukf.nimlib.j.b.e("NOS_LBS", "fetch nos lbs error, e=" + e.getMessage());
e.printStackTrace();
return z;
}
}
private boolean a(String str) throws JSONException {
String c = c(str);
com.qiyukf.nimlib.j.b.c("NOS_LBS", "fetch nos lbs, url=".concat(String.valueOf(c)));
com.qiyukf.nimlib.net.a.b.c.c b = b(c);
if (b.a() == 200) {
JSONObject b2 = b.b();
com.qiyukf.nimlib.j.b.c("NOS_LBS", "fetch nos lbs result: " + b2.toString());
b.a(com.qiyukf.nimlib.c.d(), b2);
a(false);
this.b = false;
return true;
}
com.qiyukf.nimlib.j.b.e("NOS_LBS", "fetch nos lbs failed, code=" + b.a());
return false;
}
private static com.qiyukf.nimlib.net.a.b.c.c b(String str) {
Throwable th;
int i;
InputStream inputStream;
Exception e;
?? r1 = 799;
try {
try {
str = com.qiyukf.nimlib.net.a.c.b.a((String) str, "GET");
try {
try {
com.qiyukf.nimlib.net.a.c.b.a(str, "NIM-Android-NOS-LBS-V1.0.0", com.qiyukf.nimlib.net.a.b.a.c().a(), com.qiyukf.nimlib.net.a.b.a.c().b());
i = str.getResponseCode();
try {
inputStream = str.getInputStream();
} catch (Exception e2) {
inputStream = null;
e = e2;
}
} catch (Throwable th2) {
r1 = 0;
th = th2;
com.qiyukf.nimlib.net.a.c.b.b(r1);
if (str != 0) {
str.disconnect();
}
throw th;
}
} catch (Exception e3) {
inputStream = null;
e = e3;
i = 799;
}
try {
if (inputStream != null) {
com.qiyukf.nimlib.net.a.b.c.c cVar = new com.qiyukf.nimlib.net.a.b.c.c(i, new JSONObject(com.qiyukf.nimlib.net.a.c.b.a(inputStream)), null);
com.qiyukf.nimlib.net.a.c.b.b(inputStream);
if (str != 0) {
str.disconnect();
}
return cVar;
}
com.qiyukf.nimlib.j.b.e("NOS_LBS", "fetch nos lbs error, as http no response");
com.qiyukf.nimlib.net.a.b.c.c cVar2 = new com.qiyukf.nimlib.net.a.b.c.c(899, new JSONObject(), null);
com.qiyukf.nimlib.net.a.c.b.b(inputStream);
if (str != 0) {
str.disconnect();
}
return cVar2;
} catch (Exception e4) {
e = e4;
com.qiyukf.nimlib.j.b.d("NOS_LBS", "fetch nos lbs error, error code=".concat(String.valueOf(i)), e);
com.qiyukf.nimlib.net.a.b.c.c cVar3 = new com.qiyukf.nimlib.net.a.b.c.c(i, new JSONObject(), e);
com.qiyukf.nimlib.net.a.c.b.b(inputStream);
if (str != 0) {
str.disconnect();
}
return cVar3;
}
} catch (Throwable th3) {
th = th3;
}
} catch (Exception e5) {
i = 799;
inputStream = null;
e = e5;
str = 0;
} catch (Throwable th4) {
r1 = 0;
th = th4;
str = 0;
}
}
private static String c(String str) {
return str + "?version=1.0";
}
}