Files
rr3-apk/smali_classes5/okhttp3/Dispatcher.smali
Daniel Elliott f3960ee359 Add Discord APKTool decompilation (Smali source for modding)
- Imported from https://github.com/supermegamestre/Project-Real-Resurrection-3
- APKTool decompilation (Smali bytecode) for modding and rebuilding APK
- Supports both 32-bit (armeabi-v7a) and 64-bit (arm64-v8a) architectures
- Includes full Smali source, resources, and native libraries
- Ready to rebuild APK after modifications with apktool b command
- Added comprehensive README-apktool.md with modding guide

This branch complements the JADX branches:
- Use JADX (main/discord-community) to UNDERSTAND code (readable Java)
- Use APKTool (this branch) to MODIFY and REBUILD APK (editable Smali)

Total: 44,417 files, 538.51 MB Smali source code
2026-02-18 16:13:44 -08:00

574 lines
12 KiB
Smali

.class public final Lokhttp3/Dispatcher;
.super Ljava/lang/Object;
.source "SourceFile"
# instance fields
.field public executorService:Ljava/util/concurrent/ExecutorService;
.field public idleCallback:Ljava/lang/Runnable;
.field public maxRequests:I
.field public maxRequestsPerHost:I
.field public final readyAsyncCalls:Ljava/util/Deque;
.field public final runningAsyncCalls:Ljava/util/Deque;
.field public final runningSyncCalls:Ljava/util/Deque;
# direct methods
.method static constructor <clinit>()V
.locals 0
return-void
.end method
.method public constructor <init>()V
.locals 1
.line 60
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/16 v0, 0x40
iput v0, p0, Lokhttp3/Dispatcher;->maxRequests:I
const/4 v0, 0x5
iput v0, p0, Lokhttp3/Dispatcher;->maxRequestsPerHost:I
.line 48
new-instance v0, Ljava/util/ArrayDeque;
invoke-direct {v0}, Ljava/util/ArrayDeque;-><init>()V
iput-object v0, p0, Lokhttp3/Dispatcher;->readyAsyncCalls:Ljava/util/Deque;
.line 51
new-instance v0, Ljava/util/ArrayDeque;
invoke-direct {v0}, Ljava/util/ArrayDeque;-><init>()V
iput-object v0, p0, Lokhttp3/Dispatcher;->runningAsyncCalls:Ljava/util/Deque;
.line 54
new-instance v0, Ljava/util/ArrayDeque;
invoke-direct {v0}, Ljava/util/ArrayDeque;-><init>()V
iput-object v0, p0, Lokhttp3/Dispatcher;->runningSyncCalls:Ljava/util/Deque;
return-void
.end method
# virtual methods
.method public enqueue(Lokhttp3/RealCall$AsyncCall;)V
.locals 1
.line 134
monitor-enter p0
:try_start_0
iget-object v0, p0, Lokhttp3/Dispatcher;->readyAsyncCalls:Ljava/util/Deque;
.line 135
invoke-interface {v0, p1}, Ljava/util/Deque;->add(Ljava/lang/Object;)Z
.line 139
invoke-virtual {p1}, Lokhttp3/RealCall$AsyncCall;->get()Lokhttp3/RealCall;
move-result-object v0
iget-boolean v0, v0, Lokhttp3/RealCall;->forWebSocket:Z
if-nez v0, :cond_0
.line 140
invoke-virtual {p1}, Lokhttp3/RealCall$AsyncCall;->host()Ljava/lang/String;
move-result-object v0
invoke-virtual {p0, v0}, Lokhttp3/Dispatcher;->findExistingCallWithHost(Ljava/lang/String;)Lokhttp3/RealCall$AsyncCall;
move-result-object v0
if-eqz v0, :cond_0
.line 141
invoke-virtual {p1, v0}, Lokhttp3/RealCall$AsyncCall;->reuseCallsPerHostFrom(Lokhttp3/RealCall$AsyncCall;)V
goto :goto_0
:catchall_0
move-exception p1
goto :goto_1
.line 143
:cond_0
:goto_0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 144
invoke-virtual {p0}, Lokhttp3/Dispatcher;->promoteAndExecute()Z
return-void
.line 143
:goto_1
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
.end method
.method public declared-synchronized executed(Lokhttp3/RealCall;)V
.locals 1
monitor-enter p0
:try_start_0
iget-object v0, p0, Lokhttp3/Dispatcher;->runningSyncCalls:Ljava/util/Deque;
.line 212
invoke-interface {v0, p1}, Ljava/util/Deque;->add(Ljava/lang/Object;)Z
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 213
monitor-exit p0
return-void
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method public declared-synchronized executorService()Ljava/util/concurrent/ExecutorService;
.locals 9
monitor-enter p0
:try_start_0
iget-object v0, p0, Lokhttp3/Dispatcher;->executorService:Ljava/util/concurrent/ExecutorService;
if-nez v0, :cond_0
.line 65
new-instance v0, Ljava/util/concurrent/ThreadPoolExecutor;
const/4 v2, 0x0
const v3, 0x7fffffff
const-wide/16 v4, 0x3c
sget-object v6, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
new-instance v7, Ljava/util/concurrent/SynchronousQueue;
invoke-direct {v7}, Ljava/util/concurrent/SynchronousQueue;-><init>()V
const-string v1, "OkHttp Dispatcher"
const/4 v8, 0x0
.line 66
invoke-static {v1, v8}, Lokhttp3/internal/Util;->threadFactory(Ljava/lang/String;Z)Ljava/util/concurrent/ThreadFactory;
move-result-object v8
move-object v1, v0
invoke-direct/range {v1 .. v8}, Ljava/util/concurrent/ThreadPoolExecutor;-><init>(IIJLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/BlockingQueue;Ljava/util/concurrent/ThreadFactory;)V
iput-object v0, p0, Lokhttp3/Dispatcher;->executorService:Ljava/util/concurrent/ExecutorService;
goto :goto_0
:catchall_0
move-exception v0
goto :goto_1
:cond_0
:goto_0
iget-object v0, p0, Lokhttp3/Dispatcher;->executorService:Ljava/util/concurrent/ExecutorService;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 68
monitor-exit p0
return-object v0
:goto_1
monitor-exit p0
throw v0
.end method
.method public final findExistingCallWithHost(Ljava/lang/String;)Lokhttp3/RealCall$AsyncCall;
.locals 3
iget-object v0, p0, Lokhttp3/Dispatcher;->runningAsyncCalls:Ljava/util/Deque;
.line 148
invoke-interface {v0}, Ljava/util/Deque;->iterator()Ljava/util/Iterator;
move-result-object v0
:cond_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Lokhttp3/RealCall$AsyncCall;
.line 149
invoke-virtual {v1}, Lokhttp3/RealCall$AsyncCall;->host()Ljava/lang/String;
move-result-object v2
invoke-virtual {v2, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-eqz v2, :cond_0
return-object v1
:cond_1
iget-object v0, p0, Lokhttp3/Dispatcher;->readyAsyncCalls:Ljava/util/Deque;
.line 151
invoke-interface {v0}, Ljava/util/Deque;->iterator()Ljava/util/Iterator;
move-result-object v0
:cond_2
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_3
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Lokhttp3/RealCall$AsyncCall;
.line 152
invoke-virtual {v1}, Lokhttp3/RealCall$AsyncCall;->host()Ljava/lang/String;
move-result-object v2
invoke-virtual {v2, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-eqz v2, :cond_2
return-object v1
:cond_3
const/4 p1, 0x0
return-object p1
.end method
.method public final finished(Ljava/util/Deque;Ljava/lang/Object;)V
.locals 0
.line 228
monitor-enter p0
.line 229
:try_start_0
invoke-interface {p1, p2}, Ljava/util/Deque;->remove(Ljava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_1
iget-object p1, p0, Lokhttp3/Dispatcher;->idleCallback:Ljava/lang/Runnable;
.line 231
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 233
invoke-virtual {p0}, Lokhttp3/Dispatcher;->promoteAndExecute()Z
move-result p2
if-nez p2, :cond_0
if-eqz p1, :cond_0
.line 236
invoke-interface {p1}, Ljava/lang/Runnable;->run()V
:cond_0
return-void
:catchall_0
move-exception p1
goto :goto_0
.line 229
:cond_1
:try_start_1
new-instance p1, Ljava/lang/AssertionError;
const-string p2, "Call wasn\'t in-flight!"
invoke-direct {p1, p2}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
throw p1
.line 231
:goto_0
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
.end method
.method public finished(Lokhttp3/RealCall$AsyncCall;)V
.locals 1
.line 217
invoke-virtual {p1}, Lokhttp3/RealCall$AsyncCall;->callsPerHost()Ljava/util/concurrent/atomic/AtomicInteger;
move-result-object v0
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicInteger;->decrementAndGet()I
iget-object v0, p0, Lokhttp3/Dispatcher;->runningAsyncCalls:Ljava/util/Deque;
.line 218
invoke-virtual {p0, v0, p1}, Lokhttp3/Dispatcher;->finished(Ljava/util/Deque;Ljava/lang/Object;)V
return-void
.end method
.method public finished(Lokhttp3/RealCall;)V
.locals 1
iget-object v0, p0, Lokhttp3/Dispatcher;->runningSyncCalls:Ljava/util/Deque;
.line 223
invoke-virtual {p0, v0, p1}, Lokhttp3/Dispatcher;->finished(Ljava/util/Deque;Ljava/lang/Object;)V
return-void
.end method
.method public final promoteAndExecute()Z
.locals 6
.line 185
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
.line 187
monitor-enter p0
:try_start_0
iget-object v1, p0, Lokhttp3/Dispatcher;->readyAsyncCalls:Ljava/util/Deque;
.line 188
invoke-interface {v1}, Ljava/util/Deque;->iterator()Ljava/util/Iterator;
move-result-object v1
:goto_0
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_2
.line 189
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
check-cast v2, Lokhttp3/RealCall$AsyncCall;
iget-object v3, p0, Lokhttp3/Dispatcher;->runningAsyncCalls:Ljava/util/Deque;
.line 191
invoke-interface {v3}, Ljava/util/Deque;->size()I
move-result v3
iget v4, p0, Lokhttp3/Dispatcher;->maxRequests:I
if-lt v3, v4, :cond_0
goto :goto_1
.line 192
:cond_0
invoke-virtual {v2}, Lokhttp3/RealCall$AsyncCall;->callsPerHost()Ljava/util/concurrent/atomic/AtomicInteger;
move-result-object v3
invoke-virtual {v3}, Ljava/util/concurrent/atomic/AtomicInteger;->get()I
move-result v3
iget v4, p0, Lokhttp3/Dispatcher;->maxRequestsPerHost:I
if-lt v3, v4, :cond_1
goto :goto_0
.line 194
:cond_1
invoke-interface {v1}, Ljava/util/Iterator;->remove()V
.line 195
invoke-virtual {v2}, Lokhttp3/RealCall$AsyncCall;->callsPerHost()Ljava/util/concurrent/atomic/AtomicInteger;
move-result-object v3
invoke-virtual {v3}, Ljava/util/concurrent/atomic/AtomicInteger;->incrementAndGet()I
.line 196
invoke-interface {v0, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
iget-object v3, p0, Lokhttp3/Dispatcher;->runningAsyncCalls:Ljava/util/Deque;
.line 197
invoke-interface {v3, v2}, Ljava/util/Deque;->add(Ljava/lang/Object;)Z
goto :goto_0
:catchall_0
move-exception v0
goto :goto_4
.line 199
:cond_2
:goto_1
invoke-virtual {p0}, Lokhttp3/Dispatcher;->runningCallsCount()I
move-result v1
const/4 v2, 0x0
if-lez v1, :cond_3
const/4 v1, 0x1
goto :goto_2
:cond_3
move v1, v2
.line 200
:goto_2
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 202
invoke-interface {v0}, Ljava/util/List;->size()I
move-result v3
:goto_3
if-ge v2, v3, :cond_4
.line 203
invoke-interface {v0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v4
check-cast v4, Lokhttp3/RealCall$AsyncCall;
.line 204
invoke-virtual {p0}, Lokhttp3/Dispatcher;->executorService()Ljava/util/concurrent/ExecutorService;
move-result-object v5
invoke-virtual {v4, v5}, Lokhttp3/RealCall$AsyncCall;->executeOn(Ljava/util/concurrent/ExecutorService;)V
add-int/lit8 v2, v2, 0x1
goto :goto_3
:cond_4
return v1
.line 200
:goto_4
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v0
.end method
.method public declared-synchronized runningCallsCount()I
.locals 2
monitor-enter p0
:try_start_0
iget-object v0, p0, Lokhttp3/Dispatcher;->runningAsyncCalls:Ljava/util/Deque;
.line 264
invoke-interface {v0}, Ljava/util/Deque;->size()I
move-result v0
iget-object v1, p0, Lokhttp3/Dispatcher;->runningSyncCalls:Ljava/util/Deque;
invoke-interface {v1}, Ljava/util/Deque;->size()I
move-result v1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
add-int/2addr v0, v1
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method