2021-08-11 06:37:47 +00:00
|
|
|
package c.a.q;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
2021-08-12 06:36:45 +00:00
|
|
|
import c.a.q.n0.a;
|
2021-07-24 02:37:17 +00:00
|
|
|
import com.discord.rtcconnection.RtcConnection;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.g0.t;
|
|
|
|
import d0.t.g0;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import d0.z.d.o;
|
2021-07-24 02:37:17 +00:00
|
|
|
import java.net.URI;
|
|
|
|
import javax.net.ssl.SSLSocketFactory;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
/* compiled from: RtcConnection.kt */
|
|
|
|
public final class s extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ t this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public s(t tVar) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = tVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-02 06:38:17 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-07-24 02:37:17 +00:00
|
|
|
w wVar = this.this$0.i;
|
|
|
|
RtcConnection rtcConnection = wVar.this$0;
|
|
|
|
String str = wVar.$endpoint;
|
|
|
|
String str2 = wVar.$token;
|
|
|
|
SSLSocketFactory sSLSocketFactory = wVar.$sslSocketFactory;
|
|
|
|
rtcConnection.p.succeed();
|
|
|
|
String str3 = sSLSocketFactory != null ? "wss" : "ws";
|
|
|
|
if (str == null || str.length() == 0) {
|
|
|
|
a aVar = rtcConnection.v;
|
|
|
|
if (aVar != null) {
|
2021-09-07 06:52:02 +00:00
|
|
|
aVar.c();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
2021-08-12 06:36:45 +00:00
|
|
|
rtcConnection.u(RtcConnection.State.b.a);
|
2021-07-24 02:37:17 +00:00
|
|
|
} else {
|
|
|
|
String replace$default = t.replace$default(str, ".gg", ".media", false, 4, (Object) null);
|
2021-08-28 06:29:07 +00:00
|
|
|
String v = c.d.b.a.a.v(str3, "://", replace$default);
|
|
|
|
String replace$default2 = t.replace$default(v, ":80", ":443", false, 4, (Object) null);
|
2021-07-24 02:37:17 +00:00
|
|
|
a aVar2 = rtcConnection.v;
|
|
|
|
if (aVar2 != null) {
|
2021-09-07 06:52:02 +00:00
|
|
|
aVar2.c();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
if (rtcConnection.t) {
|
2021-08-12 06:36:45 +00:00
|
|
|
RtcConnection.j(rtcConnection, false, "Connect called on destroyed instance.", null, false, 4);
|
2021-07-24 02:37:17 +00:00
|
|
|
} else if (str2 == null) {
|
2021-08-12 06:36:45 +00:00
|
|
|
RtcConnection.j(rtcConnection, false, "Connect called with no token.", null, false, 12);
|
2021-07-24 02:37:17 +00:00
|
|
|
} else {
|
2021-08-12 06:36:45 +00:00
|
|
|
rtcConnection.r("connecting via endpoint: " + replace$default + " token: " + str2);
|
2021-07-24 02:37:17 +00:00
|
|
|
try {
|
2021-08-28 06:29:07 +00:00
|
|
|
URI uri = new URI(v);
|
2021-11-02 06:38:17 +00:00
|
|
|
rtcConnection.f2163x = uri.getHost();
|
|
|
|
rtcConnection.f2164y = Integer.valueOf(uri.getPort());
|
2021-07-24 02:37:17 +00:00
|
|
|
} catch (Exception e) {
|
2021-11-02 06:38:17 +00:00
|
|
|
rtcConnection.U.e(rtcConnection.k, "Failed to parse RTC endpoint", e, g0.mapOf(d0.o.to("endpoint", replace$default)));
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
2021-08-18 06:27:30 +00:00
|
|
|
a aVar3 = new a(replace$default2, str2, sSLSocketFactory, rtcConnection.U, rtcConnection.T.c(), rtcConnection.V, rtcConnection.k);
|
|
|
|
h0 h0Var = rtcConnection.L;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(h0Var, "listener");
|
|
|
|
aVar3.p.add(h0Var);
|
2021-09-07 06:52:02 +00:00
|
|
|
aVar3.d();
|
2021-07-24 02:37:17 +00:00
|
|
|
rtcConnection.v = aVar3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|