2021-12-21 23:37:30 +00:00
|
|
|
package b.a.q.n0;
|
2021-07-20 22:20:08 +00:00
|
|
|
|
|
|
|
import androidx.annotation.AnyThread;
|
2021-08-09 22:50:01 +00:00
|
|
|
import androidx.core.app.NotificationCompat;
|
|
|
|
import com.discord.models.domain.ModelAuditLogEntry;
|
2021-07-20 22:20:08 +00:00
|
|
|
import com.discord.rtcconnection.socket.io.Opcodes;
|
|
|
|
import com.discord.rtcconnection.socket.io.Payloads;
|
|
|
|
import com.discord.utilities.debug.DebugPrintBuilder;
|
|
|
|
import com.discord.utilities.debug.DebugPrintable;
|
|
|
|
import com.discord.utilities.logging.Logger;
|
|
|
|
import com.discord.utilities.networking.Backoff;
|
2021-08-09 22:50:01 +00:00
|
|
|
import com.discord.utilities.rest.SendUtils;
|
2021-07-20 22:20:08 +00:00
|
|
|
import com.discord.utilities.time.Clock;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.JsonElement;
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
2021-11-08 18:25:28 +00:00
|
|
|
import d0.z.d.m;
|
|
|
|
import d0.z.d.o;
|
|
|
|
import f0.e0.k.h;
|
|
|
|
import f0.x;
|
2021-07-20 22:20:08 +00:00
|
|
|
import java.lang.reflect.Type;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.Timer;
|
|
|
|
import java.util.TimerTask;
|
|
|
|
import java.util.concurrent.CopyOnWriteArraySet;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import javax.net.ssl.SSLSocketFactory;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
2021-08-24 17:45:16 +00:00
|
|
|
import okhttp3.Request;
|
2021-07-20 22:20:08 +00:00
|
|
|
import okhttp3.Response;
|
|
|
|
import okhttp3.WebSocket;
|
|
|
|
import okhttp3.WebSocketListener;
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public final class a extends WebSocketListener implements DebugPrintable {
|
2021-12-17 22:03:14 +00:00
|
|
|
public static int j;
|
2021-12-21 23:37:30 +00:00
|
|
|
public static final Type k = new C0038a().getType();
|
2021-12-17 22:03:14 +00:00
|
|
|
public static final b l = new b(null);
|
|
|
|
public Long A;
|
|
|
|
public c B;
|
|
|
|
public boolean C;
|
2021-07-20 22:20:08 +00:00
|
|
|
public final String D;
|
2021-12-17 22:03:14 +00:00
|
|
|
public final String E;
|
|
|
|
public final SSLSocketFactory F;
|
|
|
|
public final Logger G;
|
2021-12-21 23:37:30 +00:00
|
|
|
public final b.a.q.c H;
|
2021-12-17 22:03:14 +00:00
|
|
|
public final Clock I;
|
|
|
|
public final String J;
|
|
|
|
public final String m;
|
2021-12-21 23:37:30 +00:00
|
|
|
public final Gson n = new b.i.d.e().a();
|
2021-12-17 22:03:14 +00:00
|
|
|
public final Timer o = new Timer();
|
|
|
|
public final Backoff p;
|
|
|
|
public final CopyOnWriteArraySet<d> q;
|
|
|
|
public int r;
|
2021-07-20 22:20:08 +00:00
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
/* renamed from: s reason: collision with root package name */
|
2021-12-21 23:37:30 +00:00
|
|
|
public WebSocket f270s;
|
2021-07-20 22:20:08 +00:00
|
|
|
public String t;
|
2021-12-17 22:03:14 +00:00
|
|
|
public String u;
|
|
|
|
public Long v;
|
|
|
|
public boolean w;
|
2021-07-20 22:20:08 +00:00
|
|
|
|
|
|
|
/* renamed from: x reason: collision with root package name */
|
2021-12-21 23:37:30 +00:00
|
|
|
public b f271x;
|
2021-07-20 22:20:08 +00:00
|
|
|
|
|
|
|
/* renamed from: y reason: collision with root package name */
|
2021-12-21 23:37:30 +00:00
|
|
|
public Long f272y;
|
2021-07-20 22:20:08 +00:00
|
|
|
|
|
|
|
/* renamed from: z reason: collision with root package name */
|
2021-12-21 23:37:30 +00:00
|
|
|
public TimerTask f273z;
|
2021-07-20 22:20:08 +00:00
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
2021-12-21 23:37:30 +00:00
|
|
|
/* renamed from: b.a.q.n0.a$a reason: collision with other inner class name */
|
|
|
|
public static final class C0038a extends TypeToken<Map<String, ? extends Integer>> {
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public static final class b {
|
|
|
|
public b(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public enum c {
|
|
|
|
DISCONNECTED,
|
|
|
|
CONNECTING,
|
|
|
|
IDENTIFYING,
|
|
|
|
RESUMING,
|
|
|
|
CONNECTED,
|
|
|
|
RECONNECTING
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public interface d {
|
|
|
|
void a(String str, String str2);
|
|
|
|
|
|
|
|
void b(boolean z2, Integer num, String str);
|
|
|
|
|
|
|
|
void c(String str, List<Integer> list);
|
|
|
|
|
|
|
|
void d(String str);
|
|
|
|
|
|
|
|
void e(long j, int i, int i2, List<Payloads.Stream> list);
|
|
|
|
|
|
|
|
void f(Map<String, Integer> map);
|
|
|
|
|
|
|
|
void g(long j);
|
|
|
|
|
|
|
|
void h();
|
|
|
|
|
|
|
|
void i();
|
|
|
|
|
|
|
|
void j(long j);
|
|
|
|
|
2021-08-18 19:46:22 +00:00
|
|
|
void k(int i, int i2, String str, List<Payloads.Stream> list);
|
2021-07-20 22:20:08 +00:00
|
|
|
|
|
|
|
void onConnecting();
|
|
|
|
|
|
|
|
void onSpeaking(long j, int i, boolean z2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public static final class e extends o implements Function1<WebSocket, Unit> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public static final e j = new e();
|
2021-07-20 22:20:08 +00:00
|
|
|
|
|
|
|
public e() {
|
|
|
|
super(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
|
|
public Unit invoke(WebSocket webSocket) {
|
|
|
|
WebSocket webSocket2 = webSocket;
|
|
|
|
m.checkNotNullParameter(webSocket2, "it");
|
|
|
|
webSocket2.e(1000, "Force Close");
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public static final class f extends o implements Function1<WebSocket, Unit> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public static final f j = new f();
|
2021-07-20 22:20:08 +00:00
|
|
|
|
|
|
|
public f() {
|
|
|
|
super(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
|
|
public Unit invoke(WebSocket webSocket) {
|
|
|
|
WebSocket webSocket2 = webSocket;
|
|
|
|
m.checkNotNullParameter(webSocket2, "it");
|
2021-08-09 22:50:01 +00:00
|
|
|
webSocket2.e(SendUtils.MAX_MESSAGE_CHARACTER_COUNT_PREMIUM, "close reason");
|
2021-07-20 22:20:08 +00:00
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public static final class g extends TimerTask {
|
2021-12-17 22:03:14 +00:00
|
|
|
public final /* synthetic */ a j;
|
2021-07-20 22:20:08 +00:00
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
2021-12-21 23:37:30 +00:00
|
|
|
/* renamed from: b.a.q.n0.a$g$a reason: collision with other inner class name */
|
|
|
|
public static final class C0039a extends o implements Function0<Unit> {
|
2021-07-20 22:20:08 +00:00
|
|
|
public final /* synthetic */ g this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-12-21 23:37:30 +00:00
|
|
|
public C0039a(g gVar) {
|
2021-07-20 22:20:08 +00:00
|
|
|
super(0);
|
|
|
|
this.this$0 = gVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-08 18:25:28 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-12-17 22:03:14 +00:00
|
|
|
a.a(this.this$0.j, true, null, "The connection timed out. Did not receive OP_HELLO in time.");
|
2021-07-20 22:20:08 +00:00
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public g(a aVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j = aVar;
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.util.TimerTask, java.lang.Runnable
|
|
|
|
public void run() {
|
2021-12-21 23:37:30 +00:00
|
|
|
this.j.m(new C0039a(this));
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public static final class h extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ int $code;
|
|
|
|
public final /* synthetic */ String $reason;
|
|
|
|
public final /* synthetic */ WebSocket $webSocket;
|
|
|
|
public final /* synthetic */ a this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public h(a aVar, WebSocket webSocket, int i, String str) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = aVar;
|
|
|
|
this.$webSocket = webSocket;
|
|
|
|
this.$code = i;
|
|
|
|
this.$reason = str;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-08 18:25:28 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-12-21 23:37:30 +00:00
|
|
|
if (!(!m.areEqual(this.$webSocket, this.this$0.f270s))) {
|
2021-07-20 22:20:08 +00:00
|
|
|
a.a(this.this$0, true, Integer.valueOf(this.$code), this.$reason);
|
|
|
|
}
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public static final class i extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ Throwable $t;
|
|
|
|
public final /* synthetic */ WebSocket $webSocket;
|
|
|
|
public final /* synthetic */ a this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public i(a aVar, WebSocket webSocket, Throwable th) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = aVar;
|
|
|
|
this.$webSocket = webSocket;
|
|
|
|
this.$t = th;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-08 18:25:28 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-12-21 23:37:30 +00:00
|
|
|
if (!(!m.areEqual(this.$webSocket, this.this$0.f270s))) {
|
2021-09-01 21:26:33 +00:00
|
|
|
a aVar = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
StringBuilder R = b.d.b.a.a.R("An error with the websocket occurred: ");
|
2021-11-08 18:25:28 +00:00
|
|
|
R.append(this.$t.getMessage());
|
|
|
|
a.a(aVar, true, null, R.toString());
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public static final class j extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ Payloads.Incoming $message;
|
|
|
|
public final /* synthetic */ WebSocket $webSocket;
|
|
|
|
public final /* synthetic */ a this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public j(a aVar, WebSocket webSocket, Payloads.Incoming incoming) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = aVar;
|
|
|
|
this.$webSocket = webSocket;
|
|
|
|
this.$message = incoming;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-08 18:25:28 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-07-20 22:20:08 +00:00
|
|
|
boolean z2 = true;
|
2021-12-21 23:37:30 +00:00
|
|
|
if (!(!m.areEqual(this.$webSocket, this.this$0.f270s))) {
|
2021-07-20 22:20:08 +00:00
|
|
|
switch (this.$message.getOpcode()) {
|
|
|
|
case 2:
|
|
|
|
a aVar = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
Object c = aVar.n.c(this.$message.getData(), Payloads.Ready.class);
|
|
|
|
m.checkNotNullExpressionValue(c, "gson.fromJson(message.da…yloads.Ready::class.java)");
|
|
|
|
Payloads.Ready ready = (Payloads.Ready) c;
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar.p.succeed();
|
|
|
|
long currentTimeMillis = aVar.I.currentTimeMillis();
|
|
|
|
Long l = aVar.A;
|
2021-07-20 22:20:08 +00:00
|
|
|
long longValue = currentTimeMillis - (l != null ? l.longValue() : 0);
|
2021-09-21 20:20:54 +00:00
|
|
|
aVar.i("[READY] took " + longValue + " ms");
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar.H.a();
|
|
|
|
for (d dVar : aVar.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar, "it");
|
2021-08-18 19:46:22 +00:00
|
|
|
dVar.k(ready.getPort(), ready.getSsrc(), ready.getIp(), ready.getStreams());
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
a aVar2 = this.this$0;
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar2.n(3, String.valueOf(aVar2.I.currentTimeMillis()));
|
2021-07-20 22:20:08 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
a aVar3 = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
Object c2 = aVar3.n.c(this.$message.getData(), Payloads.Description.class);
|
|
|
|
m.checkNotNullExpressionValue(c2, "gson.fromJson(message.da….Description::class.java)");
|
|
|
|
Payloads.Description description = (Payloads.Description) c2;
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar3.H.a();
|
|
|
|
for (d dVar2 : aVar3.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar2, "it");
|
|
|
|
dVar2.c(description.getMode(), description.getSecretKey());
|
|
|
|
dVar2.a(description.getAudioCodec(), description.getVideoCodec());
|
|
|
|
String mediaSessionId = description.getMediaSessionId();
|
|
|
|
if (mediaSessionId != null) {
|
|
|
|
dVar2.d(mediaSessionId);
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar3.C = true;
|
2021-07-20 22:20:08 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
a aVar4 = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
Object c3 = aVar4.n.c(this.$message.getData(), Payloads.Speaking.class);
|
|
|
|
m.checkNotNullExpressionValue(c3, "gson.fromJson(message.da…ads.Speaking::class.java)");
|
|
|
|
Payloads.Speaking speaking = (Payloads.Speaking) c3;
|
2021-07-20 22:20:08 +00:00
|
|
|
if (!(speaking.getUserId() == null || speaking.getSpeaking() == null)) {
|
|
|
|
Integer speaking2 = speaking.getSpeaking();
|
|
|
|
if (speaking2 == null || speaking2.intValue() != 1) {
|
|
|
|
z2 = false;
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar4.H.a();
|
|
|
|
for (d dVar3 : aVar4.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar3, "it");
|
|
|
|
dVar3.onSpeaking(speaking.getUserId().longValue(), speaking.getSsrc(), z2);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 6:
|
|
|
|
a aVar5 = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
Object c4 = aVar5.n.c(this.$message.getData(), Long.TYPE);
|
|
|
|
m.checkNotNullExpressionValue(c4, "gson.fromJson(message.data, Long::class.java)");
|
|
|
|
long longValue2 = ((Number) c4).longValue();
|
2021-12-17 22:03:14 +00:00
|
|
|
long currentTimeMillis2 = aVar5.I.currentTimeMillis();
|
2021-07-20 22:20:08 +00:00
|
|
|
long j = currentTimeMillis2 - longValue2;
|
2021-09-21 20:20:54 +00:00
|
|
|
aVar5.h("got heartbeat ack after " + j + " ms");
|
2021-12-21 23:37:30 +00:00
|
|
|
aVar5.f272y = Long.valueOf(currentTimeMillis2);
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar5.w = true;
|
|
|
|
aVar5.H.a();
|
|
|
|
for (d dVar4 : aVar5.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar4, "it");
|
|
|
|
dVar4.g(j);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
default:
|
|
|
|
a aVar6 = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
StringBuilder R = b.d.b.a.a.R("unknown opcode: ");
|
2021-11-08 18:25:28 +00:00
|
|
|
R.append(this.$message.getOpcode());
|
|
|
|
aVar6.i(R.toString());
|
2021-07-20 22:20:08 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
a aVar7 = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
Object c5 = aVar7.n.c(this.$message.getData(), Payloads.Hello.class);
|
|
|
|
m.checkNotNullExpressionValue(c5, "gson.fromJson(message.da…yloads.Hello::class.java)");
|
|
|
|
Payloads.Hello hello = (Payloads.Hello) c5;
|
|
|
|
TimerTask timerTask = aVar7.f273z;
|
2021-07-20 22:20:08 +00:00
|
|
|
if (timerTask != null) {
|
|
|
|
timerTask.cancel();
|
|
|
|
}
|
2021-09-21 20:20:54 +00:00
|
|
|
aVar7.i("[HELLO] raw: " + hello);
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar7.v = Long.valueOf(hello.getHeartbeatIntervalMs());
|
|
|
|
aVar7.r = hello.getServerVersion();
|
2021-12-21 23:37:30 +00:00
|
|
|
aVar7.f271x.cancel();
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar7.w = true;
|
2021-09-21 20:20:54 +00:00
|
|
|
aVar7.k();
|
2021-07-20 22:20:08 +00:00
|
|
|
break;
|
|
|
|
case 9:
|
2021-12-17 22:03:14 +00:00
|
|
|
this.this$0.p.succeed();
|
2021-07-20 22:20:08 +00:00
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
a aVar8 = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
Object c6 = aVar8.n.c(this.$message.getData(), Payloads.Video.class);
|
|
|
|
m.checkNotNullExpressionValue(c6, "gson.fromJson(message.da…yloads.Video::class.java)");
|
|
|
|
Payloads.Video video = (Payloads.Video) c6;
|
2021-07-20 22:20:08 +00:00
|
|
|
if (video.getUserId() != null) {
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar8.H.a();
|
|
|
|
for (d dVar5 : aVar8.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar5, "it");
|
|
|
|
dVar5.e(video.getUserId().longValue(), video.getAudioSsrc(), video.getVideoSsrc(), video.getStreams());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
a aVar9 = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
Object c7 = aVar9.n.c(this.$message.getData(), Payloads.ClientDisconnect.class);
|
|
|
|
m.checkNotNullExpressionValue(c7, "gson.fromJson(message.da…ntDisconnect::class.java)");
|
|
|
|
Payloads.ClientDisconnect clientDisconnect = (Payloads.ClientDisconnect) c7;
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar9.H.a();
|
|
|
|
for (d dVar6 : aVar9.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar6, "it");
|
|
|
|
dVar6.j(clientDisconnect.getUserId());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
a aVar10 = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
Object c8 = aVar10.n.c(this.$message.getData(), Payloads.SessionUpdate.class);
|
|
|
|
m.checkNotNullExpressionValue(c8, "gson.fromJson(message.da…essionUpdate::class.java)");
|
|
|
|
Payloads.SessionUpdate sessionUpdate = (Payloads.SessionUpdate) c8;
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar10.H.a();
|
|
|
|
for (d dVar7 : aVar10.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar7, "it");
|
|
|
|
String mediaSessionId2 = sessionUpdate.getMediaSessionId();
|
|
|
|
if (mediaSessionId2 != null) {
|
|
|
|
dVar7.d(mediaSessionId2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
a aVar11 = this.this$0;
|
2021-12-17 22:03:14 +00:00
|
|
|
Gson gson = aVar11.n;
|
2021-07-20 22:20:08 +00:00
|
|
|
JsonElement data = this.$message.getData();
|
2021-12-17 22:03:14 +00:00
|
|
|
Type type = a.k;
|
2021-07-20 22:20:08 +00:00
|
|
|
Objects.requireNonNull(gson);
|
2021-12-21 23:37:30 +00:00
|
|
|
Object d = data == null ? null : gson.d(new b.i.d.q.x.a(data), type);
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(d, "gson.fromJson(message.data, MEDIA_SINK_WANTS_TYPE)");
|
|
|
|
Map<String, Integer> map = (Map) d;
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar11.H.a();
|
|
|
|
for (d dVar8 : aVar11.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar8, "it");
|
|
|
|
dVar8.f(map);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public static final class k extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ WebSocket $webSocket;
|
|
|
|
public final /* synthetic */ a this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public k(a aVar, WebSocket webSocket) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = aVar;
|
|
|
|
this.$webSocket = webSocket;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-08 18:25:28 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-07-20 22:20:08 +00:00
|
|
|
boolean z2 = true;
|
2021-12-21 23:37:30 +00:00
|
|
|
if (!(!m.areEqual(this.$webSocket, this.this$0.f270s))) {
|
2021-07-20 22:20:08 +00:00
|
|
|
a aVar = this.this$0;
|
2021-12-17 22:03:14 +00:00
|
|
|
c cVar = aVar.B;
|
2021-07-20 22:20:08 +00:00
|
|
|
if (cVar == c.CONNECTING) {
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar.H.a();
|
|
|
|
for (d dVar : aVar.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar, "it");
|
|
|
|
dVar.i();
|
|
|
|
}
|
|
|
|
} else if (cVar == c.RECONNECTING) {
|
2021-12-17 22:03:14 +00:00
|
|
|
String str = aVar.u;
|
|
|
|
String str2 = aVar.t;
|
|
|
|
String str3 = aVar.E;
|
2021-12-21 23:37:30 +00:00
|
|
|
Long l = aVar.f272y;
|
2021-12-17 22:03:14 +00:00
|
|
|
if (l != null && aVar.I.currentTimeMillis() - l.longValue() > 60000) {
|
2021-07-20 22:20:08 +00:00
|
|
|
z2 = false;
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
if (str == null || str2 == null || !aVar.C || !z2) {
|
2021-12-21 23:37:30 +00:00
|
|
|
StringBuilder R = b.d.b.a.a.R("Cannot resume connection. resumable: ");
|
2021-12-17 22:03:14 +00:00
|
|
|
R.append(aVar.C);
|
2021-11-08 18:25:28 +00:00
|
|
|
R.append(" -- isHeartbeatRecentEnough: ");
|
|
|
|
R.append(z2);
|
|
|
|
aVar.f(false, 4801, R.toString());
|
2021-07-20 22:20:08 +00:00
|
|
|
} else {
|
2021-09-21 20:20:54 +00:00
|
|
|
aVar.i("[RESUME] resuming session. serverId=" + str2 + " sessionId=" + str);
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar.H.a();
|
|
|
|
for (d dVar2 : aVar.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar2, "it");
|
|
|
|
dVar2.h();
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar.B = c.RESUMING;
|
2021-09-21 20:20:54 +00:00
|
|
|
aVar.n(7, new Payloads.Resume(str3, str, str2));
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
a aVar2 = this.this$0;
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar2.B = c.CONNECTED;
|
|
|
|
long currentTimeMillis = aVar2.I.currentTimeMillis();
|
|
|
|
Long l2 = this.this$0.A;
|
2021-07-20 22:20:08 +00:00
|
|
|
long longValue = currentTimeMillis - (l2 != null ? l2.longValue() : 0);
|
|
|
|
a aVar3 = this.this$0;
|
2021-12-21 23:37:30 +00:00
|
|
|
StringBuilder R2 = b.d.b.a.a.R("[CONNECTED] to ");
|
2021-12-17 22:03:14 +00:00
|
|
|
R2.append(this.this$0.D);
|
2021-11-08 18:25:28 +00:00
|
|
|
aVar3.i(R2.toString());
|
2021-07-20 22:20:08 +00:00
|
|
|
a aVar4 = this.this$0;
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar4.H.a();
|
|
|
|
for (d dVar3 : aVar4.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar3, "it");
|
|
|
|
dVar3.g(longValue / ((long) 2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: RtcControlSocket.kt */
|
|
|
|
public static final class l extends o implements Function1<WebSocket, Unit> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public static final l j = new l();
|
2021-07-20 22:20:08 +00:00
|
|
|
|
|
|
|
public l() {
|
|
|
|
super(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
|
|
public Unit invoke(WebSocket webSocket) {
|
|
|
|
WebSocket webSocket2 = webSocket;
|
|
|
|
m.checkNotNullParameter(webSocket2, "it");
|
2021-08-09 22:50:01 +00:00
|
|
|
webSocket2.e(SendUtils.MAX_MESSAGE_CHARACTER_COUNT_PREMIUM, "reconnecting");
|
2021-07-20 22:20:08 +00:00
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-21 23:37:30 +00:00
|
|
|
public a(String str, String str2, SSLSocketFactory sSLSocketFactory, Logger logger, b.a.q.c cVar, Clock clock, String str3) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullParameter(str, "endpoint");
|
|
|
|
m.checkNotNullParameter(str2, "token");
|
|
|
|
m.checkNotNullParameter(logger, "logger");
|
|
|
|
m.checkNotNullParameter(cVar, "mediaEngineThreadExecutor");
|
|
|
|
m.checkNotNullParameter(clock, "clock");
|
|
|
|
m.checkNotNullParameter(str3, "loggingTagPrefix");
|
2021-12-17 22:03:14 +00:00
|
|
|
this.D = str;
|
|
|
|
this.E = str2;
|
|
|
|
this.F = sSLSocketFactory;
|
|
|
|
this.G = logger;
|
|
|
|
this.H = cVar;
|
|
|
|
this.I = clock;
|
|
|
|
this.J = str3;
|
2021-12-21 23:37:30 +00:00
|
|
|
StringBuilder V = b.d.b.a.a.V(str3, "->RtcControlSocket ");
|
2021-12-17 22:03:14 +00:00
|
|
|
int i2 = j + 1;
|
|
|
|
j = i2;
|
2021-11-08 18:25:28 +00:00
|
|
|
V.append(i2);
|
|
|
|
String sb = V.toString();
|
2021-12-17 22:03:14 +00:00
|
|
|
this.m = sb;
|
|
|
|
this.p = new Backoff(1000, 5000, 3, false, new Backoff.TimerScheduler(sb, cVar), 8, null);
|
|
|
|
this.q = new CopyOnWriteArraySet<>();
|
|
|
|
this.r = 3;
|
2021-12-21 23:37:30 +00:00
|
|
|
this.f271x = new b(this);
|
2021-12-17 22:03:14 +00:00
|
|
|
this.B = c.DISCONNECTED;
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final void a(a aVar, boolean z2, Integer num, String str) {
|
2021-12-17 22:03:14 +00:00
|
|
|
aVar.B = c.DISCONNECTED;
|
2021-07-20 22:20:08 +00:00
|
|
|
if ((num != null && num.intValue() == 4004) || ((num != null && num.intValue() == 4015) || ((num != null && num.intValue() == 4011) || (num != null && num.intValue() == 4006)))) {
|
2021-09-21 20:20:54 +00:00
|
|
|
aVar.f(true, num, str);
|
2021-12-17 22:03:14 +00:00
|
|
|
} else if (aVar.p.hasReachedFailureThreshold()) {
|
2021-09-21 20:20:54 +00:00
|
|
|
aVar.j("[WS CLOSED] Backoff exceeded. Resetting.");
|
|
|
|
aVar.f(z2, num, str);
|
2021-07-20 22:20:08 +00:00
|
|
|
} else {
|
2021-09-21 20:20:54 +00:00
|
|
|
aVar.b(null);
|
2022-01-27 00:50:41 +00:00
|
|
|
String N = b.d.b.a.a.N(new Object[]{Double.valueOf(((double) aVar.p.fail(new c(aVar, z2, num, str))) / 1000.0d)}, 1, "%.2f", "java.lang.String.format(this, *args)");
|
|
|
|
aVar.j("`[WS CLOSED] (" + z2 + ", " + num + ", " + str + ") retrying in " + N + " seconds.");
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void b(Function1<? super WebSocket, Unit> function1) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.p.cancel();
|
2021-12-21 23:37:30 +00:00
|
|
|
this.f271x.cancel();
|
|
|
|
TimerTask timerTask = this.f273z;
|
2021-07-20 22:20:08 +00:00
|
|
|
if (timerTask != null) {
|
|
|
|
timerTask.cancel();
|
|
|
|
}
|
2021-12-21 23:37:30 +00:00
|
|
|
WebSocket webSocket = this.f270s;
|
2021-07-20 22:20:08 +00:00
|
|
|
if (!(webSocket == null || function1 == null)) {
|
|
|
|
function1.invoke(webSocket);
|
|
|
|
}
|
2021-12-21 23:37:30 +00:00
|
|
|
this.f270s = null;
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void c() {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.H.a();
|
2021-09-21 20:20:54 +00:00
|
|
|
i("[CLOSE]");
|
2021-12-17 22:03:14 +00:00
|
|
|
b(e.j);
|
2021-07-20 22:20:08 +00:00
|
|
|
this.t = null;
|
2021-12-17 22:03:14 +00:00
|
|
|
this.u = null;
|
|
|
|
this.C = false;
|
|
|
|
this.B = c.DISCONNECTED;
|
|
|
|
this.H.a();
|
|
|
|
for (d dVar : this.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar, "it");
|
|
|
|
dVar.b(false, 1000, "Force Close");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final boolean d() {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.H.a();
|
|
|
|
if (this.B != c.DISCONNECTED) {
|
2021-09-21 20:20:54 +00:00
|
|
|
j("Cannot start a new connection, connection state is not disconnected");
|
|
|
|
return false;
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
this.B = c.CONNECTING;
|
2021-09-21 20:20:54 +00:00
|
|
|
e();
|
2021-12-17 22:03:14 +00:00
|
|
|
this.H.a();
|
|
|
|
for (d dVar : this.q) {
|
2021-09-21 20:20:54 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar, "it");
|
|
|
|
dVar.onConnecting();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-09-01 21:26:33 +00:00
|
|
|
@Override // com.discord.utilities.debug.DebugPrintable
|
|
|
|
public void debugPrint(DebugPrintBuilder debugPrintBuilder) {
|
|
|
|
m.checkNotNullParameter(debugPrintBuilder, "dp");
|
2021-12-17 22:03:14 +00:00
|
|
|
debugPrintBuilder.appendKeyValue("serverId", this.t);
|
|
|
|
debugPrintBuilder.appendKeyValue("sessionId", this.u);
|
|
|
|
debugPrintBuilder.appendKeyValue("heartbeatInterval", this.v);
|
2021-12-21 23:37:30 +00:00
|
|
|
debugPrintBuilder.appendKeyValue("lastHeartbeatAckTime", this.f272y);
|
2021-12-17 22:03:14 +00:00
|
|
|
debugPrintBuilder.appendKeyValue("connectionStartTime", this.A);
|
|
|
|
debugPrintBuilder.appendKeyValue("connectionState", this.B);
|
|
|
|
debugPrintBuilder.appendKeyValue("resumable", Boolean.valueOf(this.C));
|
2021-09-01 21:26:33 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void e() {
|
2021-12-21 23:37:30 +00:00
|
|
|
StringBuilder R = b.d.b.a.a.R("[CONNECT] ");
|
2021-12-17 22:03:14 +00:00
|
|
|
R.append(this.D);
|
2021-11-08 18:25:28 +00:00
|
|
|
i(R.toString());
|
2021-12-21 23:37:30 +00:00
|
|
|
if (this.f270s != null) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.G.e(this.m, "Connect called with already existing websocket", null, null);
|
|
|
|
b(f.j);
|
2021-07-20 22:20:08 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
this.A = Long.valueOf(this.I.currentTimeMillis());
|
2021-12-21 23:37:30 +00:00
|
|
|
TimerTask timerTask = this.f273z;
|
2021-07-20 22:20:08 +00:00
|
|
|
if (timerTask != null) {
|
|
|
|
timerTask.cancel();
|
|
|
|
}
|
|
|
|
g gVar = new g(this);
|
2021-12-21 23:37:30 +00:00
|
|
|
this.f273z = gVar;
|
2021-12-17 22:03:14 +00:00
|
|
|
this.o.schedule(gVar, 20000);
|
2021-07-20 22:20:08 +00:00
|
|
|
x.a aVar = new x.a();
|
|
|
|
aVar.a(1, TimeUnit.MINUTES);
|
2021-12-17 22:03:14 +00:00
|
|
|
SSLSocketFactory sSLSocketFactory = this.F;
|
2021-07-20 22:20:08 +00:00
|
|
|
if (sSLSocketFactory != null) {
|
2021-12-21 23:37:30 +00:00
|
|
|
h.a aVar2 = f0.e0.k.h.c;
|
2021-11-08 18:25:28 +00:00
|
|
|
aVar.b(sSLSocketFactory, f0.e0.k.h.a.n());
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
2021-12-21 23:37:30 +00:00
|
|
|
String H = b.d.b.a.a.H(new StringBuilder(), this.D, "?v=5");
|
2021-11-08 18:25:28 +00:00
|
|
|
i("attempting WSS connection with " + H);
|
2021-07-20 22:20:08 +00:00
|
|
|
x xVar = new x(aVar);
|
2021-08-24 17:45:16 +00:00
|
|
|
Request.a aVar3 = new Request.a();
|
2021-11-08 18:25:28 +00:00
|
|
|
aVar3.f(H);
|
2021-12-21 23:37:30 +00:00
|
|
|
this.f270s = xVar.g(aVar3.a(), this);
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void f(boolean z2, Integer num, String str) {
|
|
|
|
j("[DISCONNECT] (" + z2 + ", " + num + ", " + str + ')');
|
|
|
|
b(null);
|
2021-07-20 22:20:08 +00:00
|
|
|
this.t = null;
|
2021-12-17 22:03:14 +00:00
|
|
|
this.u = null;
|
|
|
|
this.C = false;
|
|
|
|
this.B = c.DISCONNECTED;
|
|
|
|
this.H.a();
|
|
|
|
for (d dVar : this.q) {
|
2021-07-20 22:20:08 +00:00
|
|
|
m.checkNotNullExpressionValue(dVar, "it");
|
|
|
|
dVar.b(z2, num, str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void g(long j2, String str, boolean z2) {
|
2021-08-09 22:50:01 +00:00
|
|
|
m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_REASON);
|
2021-12-17 22:03:14 +00:00
|
|
|
this.H.a();
|
2021-12-21 23:37:30 +00:00
|
|
|
if (this.f270s != null) {
|
2021-09-21 20:20:54 +00:00
|
|
|
i("Performing an immediate heartbeat on existing socket: " + str);
|
2021-12-21 23:37:30 +00:00
|
|
|
this.f271x.cancel();
|
2021-07-20 22:20:08 +00:00
|
|
|
b bVar = new b(this);
|
2021-12-21 23:37:30 +00:00
|
|
|
this.f271x = bVar;
|
2021-12-17 22:03:14 +00:00
|
|
|
this.o.schedule(bVar, j2);
|
2021-07-20 22:20:08 +00:00
|
|
|
} else if (!z2) {
|
2021-09-21 20:20:54 +00:00
|
|
|
i("Immediate heartbeat requested, but is disconnected and a reset was not requested: " + str);
|
2021-12-21 23:37:30 +00:00
|
|
|
} else if (this.p.isPending() && this.f270s == null) {
|
2021-09-21 20:20:54 +00:00
|
|
|
i("Connection backoff reset Immediate heartbeat when socket was disconnected.");
|
2021-12-17 22:03:14 +00:00
|
|
|
this.p.succeed();
|
2021-09-21 20:20:54 +00:00
|
|
|
l(false, 4802, "Reset backoff.");
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void h(String str) {
|
2021-12-17 22:03:14 +00:00
|
|
|
Logger.d$default(this.G, this.m, str, null, 4, null);
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void i(String str) {
|
2021-12-17 22:03:14 +00:00
|
|
|
Logger.i$default(this.G, this.m, str, null, 4, null);
|
2021-08-18 19:46:22 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void j(String str) {
|
2021-12-17 22:03:14 +00:00
|
|
|
Logger.w$default(this.G, this.m, str, null, 4, null);
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void k() {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (this.w) {
|
|
|
|
this.w = false;
|
|
|
|
n(3, String.valueOf(this.I.currentTimeMillis()));
|
|
|
|
Long l2 = this.v;
|
2021-07-20 22:20:08 +00:00
|
|
|
if (l2 != null) {
|
|
|
|
b bVar = new b(this);
|
2021-12-21 23:37:30 +00:00
|
|
|
this.f271x = bVar;
|
2021-12-17 22:03:14 +00:00
|
|
|
this.o.schedule(bVar, l2.longValue());
|
2021-07-20 22:20:08 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-09-21 20:20:54 +00:00
|
|
|
j("onHeartbeatInterval called when heartbeatInterval was null");
|
2021-07-20 22:20:08 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
b(d.j);
|
2022-01-27 00:50:41 +00:00
|
|
|
String N = b.d.b.a.a.N(new Object[]{Double.valueOf(((double) this.p.fail(new e(this))) / 1000.0d)}, 1, "%.2f", "java.lang.String.format(this, *args)");
|
|
|
|
j("[ACK TIMEOUT] reconnecting in " + N + " seconds.");
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void l(boolean z2, Integer num, String str) {
|
|
|
|
i("[RECONNECT] wasFatal=" + z2 + " code=" + num + " reason=" + str);
|
2021-12-17 22:03:14 +00:00
|
|
|
b(l.j);
|
|
|
|
this.B = c.RECONNECTING;
|
2021-09-21 20:20:54 +00:00
|
|
|
e();
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
/* JADX WARNING: Unknown variable types count: 1 */
|
|
|
|
@AnyThread
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void m(Function0<Unit> function0) {
|
2021-12-21 23:37:30 +00:00
|
|
|
b.a.q.c cVar = this.H;
|
2021-07-20 22:20:08 +00:00
|
|
|
if (function0 != null) {
|
|
|
|
function0 = new f(function0);
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
cVar.l.execute((Runnable) function0);
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 20:20:54 +00:00
|
|
|
public final void n(int i2, Object obj) {
|
2021-12-21 23:37:30 +00:00
|
|
|
WebSocket webSocket = this.f270s;
|
2021-09-01 21:26:33 +00:00
|
|
|
if (webSocket == null) {
|
2021-12-21 23:37:30 +00:00
|
|
|
StringBuilder R = b.d.b.a.a.R("opcode() websocket null. opcode: ");
|
2021-11-08 18:25:28 +00:00
|
|
|
R.append(Opcodes.INSTANCE.getNameOf(i2));
|
2021-12-17 22:03:14 +00:00
|
|
|
this.G.e(this.m, R.toString(), null, null);
|
2021-09-01 21:26:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
try {
|
2021-12-17 22:03:14 +00:00
|
|
|
String m = this.n.m(new Payloads.Outgoing(i2, obj));
|
2021-09-21 20:20:54 +00:00
|
|
|
h("sending (" + Opcodes.INSTANCE.getNameOf(i2) + "): " + m);
|
2021-09-01 21:26:33 +00:00
|
|
|
m.checkNotNullExpressionValue(m, "json");
|
|
|
|
webSocket.a(m);
|
|
|
|
} catch (Exception unused) {
|
2021-09-21 20:20:54 +00:00
|
|
|
j("exception sending opcode: " + i2 + " and payload: " + obj);
|
2021-09-01 21:26:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-20 22:20:08 +00:00
|
|
|
@Override // okhttp3.WebSocketListener
|
|
|
|
public void onClosed(WebSocket webSocket, int i2, String str) {
|
|
|
|
m.checkNotNullParameter(webSocket, "webSocket");
|
2021-08-09 22:50:01 +00:00
|
|
|
m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_REASON);
|
2021-07-20 22:20:08 +00:00
|
|
|
super.onClosed(webSocket, i2, str);
|
2021-09-21 20:20:54 +00:00
|
|
|
m(new h(this, webSocket, i2, str));
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // okhttp3.WebSocketListener
|
|
|
|
public void onClosing(WebSocket webSocket, int i2, String str) {
|
|
|
|
m.checkNotNullParameter(webSocket, "webSocket");
|
2021-08-09 22:50:01 +00:00
|
|
|
m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_REASON);
|
2021-11-08 18:25:28 +00:00
|
|
|
((f0.e0.n.d) webSocket).e(i2, str);
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // okhttp3.WebSocketListener
|
|
|
|
public void onFailure(WebSocket webSocket, Throwable th, Response response) {
|
|
|
|
m.checkNotNullParameter(webSocket, "webSocket");
|
|
|
|
m.checkNotNullParameter(th, "t");
|
|
|
|
super.onFailure(webSocket, th, response);
|
2021-09-21 20:20:54 +00:00
|
|
|
m(new i(this, webSocket, th));
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // okhttp3.WebSocketListener
|
|
|
|
public void onMessage(WebSocket webSocket, String str) {
|
|
|
|
m.checkNotNullParameter(webSocket, "webSocket");
|
2021-08-09 22:50:01 +00:00
|
|
|
m.checkNotNullParameter(str, NotificationCompat.MessagingStyle.Message.KEY_TEXT);
|
2022-01-27 00:50:41 +00:00
|
|
|
Payloads.Incoming incoming = (Payloads.Incoming) b.i.a.f.e.o.f.E1(Payloads.Incoming.class).cast(this.n.g(str, Payloads.Incoming.class));
|
2021-07-20 22:20:08 +00:00
|
|
|
super.onMessage(webSocket, str);
|
2021-12-21 23:37:30 +00:00
|
|
|
StringBuilder R = b.d.b.a.a.R("received (");
|
2021-11-08 18:25:28 +00:00
|
|
|
R.append(Opcodes.INSTANCE.getNameOf(incoming.getOpcode()));
|
|
|
|
R.append("): ");
|
|
|
|
R.append(incoming);
|
|
|
|
h(R.toString());
|
2021-09-21 20:20:54 +00:00
|
|
|
m(new j(this, webSocket, incoming));
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // okhttp3.WebSocketListener
|
|
|
|
public void onOpen(WebSocket webSocket, Response response) {
|
|
|
|
m.checkNotNullParameter(webSocket, "webSocket");
|
|
|
|
m.checkNotNullParameter(response, "response");
|
|
|
|
super.onOpen(webSocket, response);
|
2021-09-21 20:20:54 +00:00
|
|
|
m(new k(this, webSocket));
|
2021-07-20 22:20:08 +00:00
|
|
|
}
|
|
|
|
}
|