2021-08-10 21:50:53 +00:00
|
|
|
package c.a.r;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-08-10 21:50:53 +00:00
|
|
|
import c.a.r.o0.a;
|
2021-07-09 21:07:36 +00:00
|
|
|
import com.discord.rtcconnection.RtcConnection;
|
|
|
|
import d0.g0.t;
|
|
|
|
import d0.t.g0;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import d0.z.d.o;
|
|
|
|
import java.net.URI;
|
|
|
|
import javax.net.ssl.SSLSocketFactory;
|
2021-06-27 20:44:35 +00:00
|
|
|
import kotlin.Unit;
|
2021-07-09 21:07:36 +00:00
|
|
|
import kotlin.jvm.functions.Function0;
|
2021-06-27 20:44:35 +00:00
|
|
|
/* compiled from: RtcConnection.kt */
|
2021-07-09 21:07:36 +00:00
|
|
|
public final class s extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ t this$0;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-07-09 21:07:36 +00:00
|
|
|
/* 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;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
2021-07-09 21:07:36 +00:00
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
|
|
|
public Unit mo1invoke() {
|
|
|
|
w wVar = this.this$0.i;
|
|
|
|
RtcConnection rtcConnection = wVar.this$0;
|
|
|
|
String str = wVar.$endpoint;
|
|
|
|
String str2 = wVar.$token;
|
|
|
|
SSLSocketFactory sSLSocketFactory = wVar.$sslSocketFactory;
|
2021-07-13 20:48:29 +00:00
|
|
|
rtcConnection.p.succeed();
|
2021-07-09 21:07:36 +00:00
|
|
|
String str3 = sSLSocketFactory != null ? "wss" : "ws";
|
|
|
|
if (str == null || str.length() == 0) {
|
2021-07-13 20:48:29 +00:00
|
|
|
a aVar = rtcConnection.v;
|
2021-07-09 21:07:36 +00:00
|
|
|
if (aVar != null) {
|
|
|
|
aVar.e();
|
|
|
|
}
|
2021-07-20 22:20:08 +00:00
|
|
|
rtcConnection.v(RtcConnection.State.b.a);
|
2021-07-09 21:07:36 +00:00
|
|
|
} else {
|
|
|
|
String replace$default = t.replace$default(str, ".gg", ".media", false, 4, (Object) null);
|
2021-07-27 04:36:47 +00:00
|
|
|
String t = c.d.b.a.a.t(str3, "://", replace$default);
|
|
|
|
String replace$default2 = t.replace$default(t, ":80", ":443", false, 4, (Object) null);
|
2021-07-13 20:48:29 +00:00
|
|
|
a aVar2 = rtcConnection.v;
|
2021-07-09 21:07:36 +00:00
|
|
|
if (aVar2 != null) {
|
|
|
|
aVar2.e();
|
|
|
|
}
|
2021-07-13 20:48:29 +00:00
|
|
|
if (rtcConnection.t) {
|
2021-07-20 22:20:08 +00:00
|
|
|
RtcConnection.k(rtcConnection, false, "Connect called on destroyed instance.", null, false, 4);
|
2021-07-09 21:07:36 +00:00
|
|
|
} else if (str2 == null) {
|
2021-07-20 22:20:08 +00:00
|
|
|
RtcConnection.k(rtcConnection, false, "Connect called with no token.", null, false, 12);
|
2021-07-09 21:07:36 +00:00
|
|
|
} else {
|
2021-07-20 22:20:08 +00:00
|
|
|
rtcConnection.s("connecting via endpoint: " + replace$default + " token: " + str2);
|
2021-07-09 21:07:36 +00:00
|
|
|
try {
|
2021-07-27 04:36:47 +00:00
|
|
|
URI uri = new URI(t);
|
2021-08-18 19:46:22 +00:00
|
|
|
rtcConnection.f2120x = uri.getHost();
|
|
|
|
rtcConnection.f2121y = Integer.valueOf(uri.getPort());
|
2021-07-09 21:07:36 +00:00
|
|
|
} catch (Exception e) {
|
2021-07-20 22:20:08 +00:00
|
|
|
rtcConnection.T.e(rtcConnection.k, "Failed to parse RTC endpoint", e, g0.mapOf(d0.o.to("endpoint", replace$default)));
|
2021-07-09 21:07:36 +00:00
|
|
|
}
|
2021-07-20 22:20:08 +00:00
|
|
|
a aVar3 = new a(replace$default2, str2, sSLSocketFactory, rtcConnection.T, rtcConnection.S.c(), rtcConnection.U, rtcConnection.k);
|
2021-08-10 21:50:53 +00:00
|
|
|
h0 h0Var = rtcConnection.K;
|
|
|
|
m.checkNotNullParameter(h0Var, "listener");
|
|
|
|
aVar3.p.add(h0Var);
|
2021-07-09 21:07:36 +00:00
|
|
|
aVar3.f();
|
2021-07-13 20:48:29 +00:00
|
|
|
rtcConnection.v = aVar3;
|
2021-07-09 21:07:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return Unit.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|