Http2Connection.smali 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971
  1. .class public final Lokhttp3/internal/http2/Http2Connection;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Ljava/io/Closeable;
  6. # annotations
  7. .annotation system Ldalvik/annotation/MemberClasses;
  8. value = {
  9. Lokhttp3/internal/http2/Http2Connection$Listener;,
  10. Lokhttp3/internal/http2/Http2Connection$ReaderRunnable;,
  11. Lokhttp3/internal/http2/Http2Connection$Builder;
  12. }
  13. .end annotation
  14. # static fields
  15. .field static final synthetic $assertionsDisabled:Z = false
  16. .field private static final OKHTTP_CLIENT_WINDOW_SIZE:I = 0x1000000
  17. .field static final executor:Ljava/util/concurrent/ExecutorService;
  18. # instance fields
  19. .field bytesLeftInWriteWindow:J
  20. .field final client:Z
  21. .field final currentPushRequests:Ljava/util/Set;
  22. .annotation system Ldalvik/annotation/Signature;
  23. value = {
  24. "Ljava/util/Set<",
  25. "Ljava/lang/Integer;",
  26. ">;"
  27. }
  28. .end annotation
  29. .end field
  30. .field final hostname:Ljava/lang/String;
  31. .field lastGoodStreamId:I
  32. .field final listener:Lokhttp3/internal/http2/Http2Connection$Listener;
  33. .field private nextPingId:I
  34. .field nextStreamId:I
  35. .field okHttpSettings:Lokhttp3/internal/http2/Settings;
  36. .field final peerSettings:Lokhttp3/internal/http2/Settings;
  37. .field private pings:Ljava/util/Map;
  38. .annotation system Ldalvik/annotation/Signature;
  39. value = {
  40. "Ljava/util/Map<",
  41. "Ljava/lang/Integer;",
  42. "Lokhttp3/internal/http2/Ping;",
  43. ">;"
  44. }
  45. .end annotation
  46. .end field
  47. .field private final pushExecutor:Ljava/util/concurrent/ExecutorService;
  48. .field final pushObserver:Lokhttp3/internal/http2/PushObserver;
  49. .field final readerRunnable:Lokhttp3/internal/http2/Http2Connection$ReaderRunnable;
  50. .field receivedInitialPeerSettings:Z
  51. .field shutdown:Z
  52. .field final socket:Ljava/net/Socket;
  53. .field final streams:Ljava/util/Map;
  54. .annotation system Ldalvik/annotation/Signature;
  55. value = {
  56. "Ljava/util/Map<",
  57. "Ljava/lang/Integer;",
  58. "Lokhttp3/internal/http2/Http2Stream;",
  59. ">;"
  60. }
  61. .end annotation
  62. .end field
  63. .field unacknowledgedBytesRead:J
  64. .field final writer:Lokhttp3/internal/http2/Http2Writer;
  65. # direct methods
  66. .method static constructor <clinit>()V
  67. .locals 9
  68. const-class v0, Lokhttp3/internal/http2/Http2Connection;
  69. new-instance v0, Ljava/util/concurrent/ThreadPoolExecutor;
  70. const/4 v2, 0x0
  71. const v3, 0x7fffffff
  72. const-wide/16 v4, 0x3c
  73. sget-object v6, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
  74. new-instance v7, Ljava/util/concurrent/SynchronousQueue;
  75. invoke-direct {v7}, Ljava/util/concurrent/SynchronousQueue;-><init>()V
  76. const/4 v1, 0x1
  77. const-string v8, "OkHttp Http2Connection"
  78. invoke-static {v8, v1}, Lokhttp3/internal/Util;->threadFactory(Ljava/lang/String;Z)Ljava/util/concurrent/ThreadFactory;
  79. move-result-object v8
  80. move-object v1, v0
  81. invoke-direct/range {v1 .. v8}, Ljava/util/concurrent/ThreadPoolExecutor;-><init>(IIJLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/BlockingQueue;Ljava/util/concurrent/ThreadFactory;)V
  82. sput-object v0, Lokhttp3/internal/http2/Http2Connection;->executor:Ljava/util/concurrent/ExecutorService;
  83. return-void
  84. .end method
  85. .method constructor <init>(Lokhttp3/internal/http2/Http2Connection$Builder;)V
  86. .locals 12
  87. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  88. new-instance v0, Ljava/util/LinkedHashMap;
  89. invoke-direct {v0}, Ljava/util/LinkedHashMap;-><init>()V
  90. iput-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->streams:Ljava/util/Map;
  91. const-wide/16 v0, 0x0
  92. iput-wide v0, p0, Lokhttp3/internal/http2/Http2Connection;->unacknowledgedBytesRead:J
  93. new-instance v0, Lokhttp3/internal/http2/Settings;
  94. invoke-direct {v0}, Lokhttp3/internal/http2/Settings;-><init>()V
  95. iput-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->okHttpSettings:Lokhttp3/internal/http2/Settings;
  96. new-instance v0, Lokhttp3/internal/http2/Settings;
  97. invoke-direct {v0}, Lokhttp3/internal/http2/Settings;-><init>()V
  98. iput-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->peerSettings:Lokhttp3/internal/http2/Settings;
  99. const/4 v0, 0x0
  100. iput-boolean v0, p0, Lokhttp3/internal/http2/Http2Connection;->receivedInitialPeerSettings:Z
  101. new-instance v1, Ljava/util/LinkedHashSet;
  102. invoke-direct {v1}, Ljava/util/LinkedHashSet;-><init>()V
  103. iput-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->currentPushRequests:Ljava/util/Set;
  104. iget-object v1, p1, Lokhttp3/internal/http2/Http2Connection$Builder;->pushObserver:Lokhttp3/internal/http2/PushObserver;
  105. iput-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->pushObserver:Lokhttp3/internal/http2/PushObserver;
  106. iget-boolean v1, p1, Lokhttp3/internal/http2/Http2Connection$Builder;->client:Z
  107. iput-boolean v1, p0, Lokhttp3/internal/http2/Http2Connection;->client:Z
  108. iget-object v2, p1, Lokhttp3/internal/http2/Http2Connection$Builder;->listener:Lokhttp3/internal/http2/Http2Connection$Listener;
  109. iput-object v2, p0, Lokhttp3/internal/http2/Http2Connection;->listener:Lokhttp3/internal/http2/Http2Connection$Listener;
  110. const/4 v2, 0x2
  111. const/4 v3, 0x1
  112. if-eqz v1, :cond_0
  113. const/4 v1, 0x1
  114. goto :goto_0
  115. :cond_0
  116. const/4 v1, 0x2
  117. :goto_0
  118. iput v1, p0, Lokhttp3/internal/http2/Http2Connection;->nextStreamId:I
  119. iget-boolean v1, p1, Lokhttp3/internal/http2/Http2Connection$Builder;->client:Z
  120. if-eqz v1, :cond_1
  121. iget v1, p0, Lokhttp3/internal/http2/Http2Connection;->nextStreamId:I
  122. add-int/2addr v1, v2
  123. iput v1, p0, Lokhttp3/internal/http2/Http2Connection;->nextStreamId:I
  124. :cond_1
  125. iget-boolean v1, p1, Lokhttp3/internal/http2/Http2Connection$Builder;->client:Z
  126. if-eqz v1, :cond_2
  127. const/4 v2, 0x1
  128. :cond_2
  129. iput v2, p0, Lokhttp3/internal/http2/Http2Connection;->nextPingId:I
  130. iget-boolean v1, p1, Lokhttp3/internal/http2/Http2Connection$Builder;->client:Z
  131. const/4 v2, 0x7
  132. if-eqz v1, :cond_3
  133. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->okHttpSettings:Lokhttp3/internal/http2/Settings;
  134. const/high16 v4, 0x1000000
  135. invoke-virtual {v1, v2, v4}, Lokhttp3/internal/http2/Settings;->set(II)Lokhttp3/internal/http2/Settings;
  136. :cond_3
  137. iget-object v1, p1, Lokhttp3/internal/http2/Http2Connection$Builder;->hostname:Ljava/lang/String;
  138. iput-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->hostname:Ljava/lang/String;
  139. new-instance v1, Ljava/util/concurrent/ThreadPoolExecutor;
  140. const/4 v5, 0x0
  141. const/4 v6, 0x1
  142. const-wide/16 v7, 0x3c
  143. sget-object v9, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
  144. new-instance v10, Ljava/util/concurrent/LinkedBlockingQueue;
  145. invoke-direct {v10}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>()V
  146. new-array v4, v3, [Ljava/lang/Object;
  147. iget-object v11, p0, Lokhttp3/internal/http2/Http2Connection;->hostname:Ljava/lang/String;
  148. aput-object v11, v4, v0
  149. const-string v0, "OkHttp %s Push Observer"
  150. invoke-static {v0, v4}, Lokhttp3/internal/Util;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
  151. move-result-object v0
  152. invoke-static {v0, v3}, Lokhttp3/internal/Util;->threadFactory(Ljava/lang/String;Z)Ljava/util/concurrent/ThreadFactory;
  153. move-result-object v11
  154. move-object v4, v1
  155. invoke-direct/range {v4 .. v11}, Ljava/util/concurrent/ThreadPoolExecutor;-><init>(IIJLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/BlockingQueue;Ljava/util/concurrent/ThreadFactory;)V
  156. iput-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->pushExecutor:Ljava/util/concurrent/ExecutorService;
  157. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->peerSettings:Lokhttp3/internal/http2/Settings;
  158. const v1, 0xffff
  159. invoke-virtual {v0, v2, v1}, Lokhttp3/internal/http2/Settings;->set(II)Lokhttp3/internal/http2/Settings;
  160. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->peerSettings:Lokhttp3/internal/http2/Settings;
  161. const/4 v1, 0x5
  162. const/16 v2, 0x4000
  163. invoke-virtual {v0, v1, v2}, Lokhttp3/internal/http2/Settings;->set(II)Lokhttp3/internal/http2/Settings;
  164. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->peerSettings:Lokhttp3/internal/http2/Settings;
  165. invoke-virtual {v0}, Lokhttp3/internal/http2/Settings;->getInitialWindowSize()I
  166. move-result v0
  167. int-to-long v0, v0
  168. iput-wide v0, p0, Lokhttp3/internal/http2/Http2Connection;->bytesLeftInWriteWindow:J
  169. iget-object v0, p1, Lokhttp3/internal/http2/Http2Connection$Builder;->socket:Ljava/net/Socket;
  170. iput-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->socket:Ljava/net/Socket;
  171. new-instance v0, Lokhttp3/internal/http2/Http2Writer;
  172. iget-object v1, p1, Lokhttp3/internal/http2/Http2Connection$Builder;->sink:Lokio/BufferedSink;
  173. iget-boolean v2, p0, Lokhttp3/internal/http2/Http2Connection;->client:Z
  174. invoke-direct {v0, v1, v2}, Lokhttp3/internal/http2/Http2Writer;-><init>(Lokio/BufferedSink;Z)V
  175. iput-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  176. new-instance v0, Lokhttp3/internal/http2/Http2Connection$ReaderRunnable;
  177. new-instance v1, Lokhttp3/internal/http2/Http2Reader;
  178. iget-object p1, p1, Lokhttp3/internal/http2/Http2Connection$Builder;->source:Lokio/BufferedSource;
  179. iget-boolean v2, p0, Lokhttp3/internal/http2/Http2Connection;->client:Z
  180. invoke-direct {v1, p1, v2}, Lokhttp3/internal/http2/Http2Reader;-><init>(Lokio/BufferedSource;Z)V
  181. invoke-direct {v0, p0, v1}, Lokhttp3/internal/http2/Http2Connection$ReaderRunnable;-><init>(Lokhttp3/internal/http2/Http2Connection;Lokhttp3/internal/http2/Http2Reader;)V
  182. iput-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->readerRunnable:Lokhttp3/internal/http2/Http2Connection$ReaderRunnable;
  183. return-void
  184. .end method
  185. .method private newStream(ILjava/util/List;Z)Lokhttp3/internal/http2/Http2Stream;
  186. .locals 10
  187. .annotation system Ldalvik/annotation/Signature;
  188. value = {
  189. "(I",
  190. "Ljava/util/List<",
  191. "Lokhttp3/internal/http2/Header;",
  192. ">;Z)",
  193. "Lokhttp3/internal/http2/Http2Stream;"
  194. }
  195. .end annotation
  196. .annotation system Ldalvik/annotation/Throws;
  197. value = {
  198. Ljava/io/IOException;
  199. }
  200. .end annotation
  201. xor-int/lit8 v6, p3, 0x1
  202. const/4 v4, 0x0
  203. iget-object v7, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  204. monitor-enter v7
  205. :try_start_0
  206. monitor-enter p0
  207. :try_end_0
  208. .catchall {:try_start_0 .. :try_end_0} :catchall_1
  209. :try_start_1
  210. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Connection;->shutdown:Z
  211. if-nez v0, :cond_6
  212. iget v8, p0, Lokhttp3/internal/http2/Http2Connection;->nextStreamId:I
  213. iget v0, p0, Lokhttp3/internal/http2/Http2Connection;->nextStreamId:I
  214. add-int/lit8 v0, v0, 0x2
  215. iput v0, p0, Lokhttp3/internal/http2/Http2Connection;->nextStreamId:I
  216. new-instance v9, Lokhttp3/internal/http2/Http2Stream;
  217. move-object v0, v9
  218. move v1, v8
  219. move-object v2, p0
  220. move v3, v6
  221. move-object v5, p2
  222. invoke-direct/range {v0 .. v5}, Lokhttp3/internal/http2/Http2Stream;-><init>(ILokhttp3/internal/http2/Http2Connection;ZZLjava/util/List;)V
  223. if-eqz p3, :cond_1
  224. iget-wide v0, p0, Lokhttp3/internal/http2/Http2Connection;->bytesLeftInWriteWindow:J
  225. const-wide/16 v2, 0x0
  226. cmp-long p3, v0, v2
  227. if-eqz p3, :cond_1
  228. iget-wide v0, v9, Lokhttp3/internal/http2/Http2Stream;->bytesLeftInWriteWindow:J
  229. cmp-long p3, v0, v2
  230. if-nez p3, :cond_0
  231. goto :goto_0
  232. :cond_0
  233. const/4 p3, 0x0
  234. goto :goto_1
  235. :cond_1
  236. :goto_0
  237. const/4 p3, 0x1
  238. :goto_1
  239. invoke-virtual {v9}, Lokhttp3/internal/http2/Http2Stream;->isOpen()Z
  240. move-result v0
  241. if-eqz v0, :cond_2
  242. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->streams:Ljava/util/Map;
  243. invoke-static {v8}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  244. move-result-object v1
  245. invoke-interface {v0, v1, v9}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
  246. :cond_2
  247. monitor-exit p0
  248. :try_end_1
  249. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  250. if-nez p1, :cond_3
  251. :try_start_2
  252. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  253. invoke-virtual {v0, v6, v8, p1, p2}, Lokhttp3/internal/http2/Http2Writer;->synStream(ZIILjava/util/List;)V
  254. goto :goto_2
  255. :cond_3
  256. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Connection;->client:Z
  257. if-nez v0, :cond_5
  258. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  259. invoke-virtual {v0, p1, v8, p2}, Lokhttp3/internal/http2/Http2Writer;->pushPromise(IILjava/util/List;)V
  260. :goto_2
  261. monitor-exit v7
  262. :try_end_2
  263. .catchall {:try_start_2 .. :try_end_2} :catchall_1
  264. if-eqz p3, :cond_4
  265. iget-object p1, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  266. invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Writer;->flush()V
  267. :cond_4
  268. return-object v9
  269. :cond_5
  270. :try_start_3
  271. new-instance p1, Ljava/lang/IllegalArgumentException;
  272. const-string p2, "client streams shouldn\'t have associated stream IDs"
  273. invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  274. throw p1
  275. :try_end_3
  276. .catchall {:try_start_3 .. :try_end_3} :catchall_1
  277. :cond_6
  278. :try_start_4
  279. new-instance p1, Lokhttp3/internal/http2/ConnectionShutdownException;
  280. invoke-direct {p1}, Lokhttp3/internal/http2/ConnectionShutdownException;-><init>()V
  281. throw p1
  282. :catchall_0
  283. move-exception p1
  284. monitor-exit p0
  285. :try_end_4
  286. .catchall {:try_start_4 .. :try_end_4} :catchall_0
  287. :try_start_5
  288. throw p1
  289. :catchall_1
  290. move-exception p1
  291. monitor-exit v7
  292. :try_end_5
  293. .catchall {:try_start_5 .. :try_end_5} :catchall_1
  294. throw p1
  295. .end method
  296. # virtual methods
  297. .method addBytesToWriteWindow(J)V
  298. .locals 3
  299. iget-wide v0, p0, Lokhttp3/internal/http2/Http2Connection;->bytesLeftInWriteWindow:J
  300. add-long/2addr v0, p1
  301. iput-wide v0, p0, Lokhttp3/internal/http2/Http2Connection;->bytesLeftInWriteWindow:J
  302. const-wide/16 v0, 0x0
  303. cmp-long v2, p1, v0
  304. if-lez v2, :cond_0
  305. invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
  306. :cond_0
  307. return-void
  308. .end method
  309. .method public close()V
  310. .locals 2
  311. .annotation system Ldalvik/annotation/Throws;
  312. value = {
  313. Ljava/io/IOException;
  314. }
  315. .end annotation
  316. sget-object v0, Lokhttp3/internal/http2/ErrorCode;->NO_ERROR:Lokhttp3/internal/http2/ErrorCode;
  317. sget-object v1, Lokhttp3/internal/http2/ErrorCode;->CANCEL:Lokhttp3/internal/http2/ErrorCode;
  318. invoke-virtual {p0, v0, v1}, Lokhttp3/internal/http2/Http2Connection;->close(Lokhttp3/internal/http2/ErrorCode;Lokhttp3/internal/http2/ErrorCode;)V
  319. return-void
  320. .end method
  321. .method close(Lokhttp3/internal/http2/ErrorCode;Lokhttp3/internal/http2/ErrorCode;)V
  322. .locals 6
  323. .annotation system Ldalvik/annotation/Throws;
  324. value = {
  325. Ljava/io/IOException;
  326. }
  327. .end annotation
  328. const/4 v0, 0x0
  329. :try_start_0
  330. invoke-virtual {p0, p1}, Lokhttp3/internal/http2/Http2Connection;->shutdown(Lokhttp3/internal/http2/ErrorCode;)V
  331. :try_end_0
  332. .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
  333. move-object p1, v0
  334. goto :goto_0
  335. :catch_0
  336. move-exception p1
  337. :goto_0
  338. monitor-enter p0
  339. :try_start_1
  340. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->streams:Ljava/util/Map;
  341. invoke-interface {v1}, Ljava/util/Map;->isEmpty()Z
  342. move-result v1
  343. if-nez v1, :cond_0
  344. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->streams:Ljava/util/Map;
  345. invoke-interface {v1}, Ljava/util/Map;->values()Ljava/util/Collection;
  346. move-result-object v1
  347. iget-object v2, p0, Lokhttp3/internal/http2/Http2Connection;->streams:Ljava/util/Map;
  348. invoke-interface {v2}, Ljava/util/Map;->size()I
  349. move-result v2
  350. new-array v2, v2, [Lokhttp3/internal/http2/Http2Stream;
  351. invoke-interface {v1, v2}, Ljava/util/Collection;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
  352. move-result-object v1
  353. check-cast v1, [Lokhttp3/internal/http2/Http2Stream;
  354. iget-object v2, p0, Lokhttp3/internal/http2/Http2Connection;->streams:Ljava/util/Map;
  355. invoke-interface {v2}, Ljava/util/Map;->clear()V
  356. goto :goto_1
  357. :cond_0
  358. move-object v1, v0
  359. :goto_1
  360. iget-object v2, p0, Lokhttp3/internal/http2/Http2Connection;->pings:Ljava/util/Map;
  361. if-eqz v2, :cond_1
  362. iget-object v2, p0, Lokhttp3/internal/http2/Http2Connection;->pings:Ljava/util/Map;
  363. invoke-interface {v2}, Ljava/util/Map;->values()Ljava/util/Collection;
  364. move-result-object v2
  365. iget-object v3, p0, Lokhttp3/internal/http2/Http2Connection;->pings:Ljava/util/Map;
  366. invoke-interface {v3}, Ljava/util/Map;->size()I
  367. move-result v3
  368. new-array v3, v3, [Lokhttp3/internal/http2/Ping;
  369. invoke-interface {v2, v3}, Ljava/util/Collection;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
  370. move-result-object v2
  371. check-cast v2, [Lokhttp3/internal/http2/Ping;
  372. iput-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->pings:Ljava/util/Map;
  373. move-object v0, v2
  374. :cond_1
  375. monitor-exit p0
  376. :try_end_1
  377. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  378. const/4 v2, 0x0
  379. if-eqz v1, :cond_4
  380. array-length v3, v1
  381. move-object v4, p1
  382. const/4 p1, 0x0
  383. :goto_2
  384. if-ge p1, v3, :cond_3
  385. aget-object v5, v1, p1
  386. :try_start_2
  387. invoke-virtual {v5, p2}, Lokhttp3/internal/http2/Http2Stream;->close(Lokhttp3/internal/http2/ErrorCode;)V
  388. :try_end_2
  389. .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1
  390. goto :goto_3
  391. :catch_1
  392. move-exception v5
  393. if-eqz v4, :cond_2
  394. move-object v4, v5
  395. :cond_2
  396. :goto_3
  397. add-int/lit8 p1, p1, 0x1
  398. goto :goto_2
  399. :cond_3
  400. move-object p1, v4
  401. :cond_4
  402. if-eqz v0, :cond_5
  403. array-length p2, v0
  404. :goto_4
  405. if-ge v2, p2, :cond_5
  406. aget-object v1, v0, v2
  407. invoke-virtual {v1}, Lokhttp3/internal/http2/Ping;->cancel()V
  408. add-int/lit8 v2, v2, 0x1
  409. goto :goto_4
  410. :cond_5
  411. :try_start_3
  412. iget-object p2, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  413. invoke-virtual {p2}, Lokhttp3/internal/http2/Http2Writer;->close()V
  414. :try_end_3
  415. .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_2
  416. goto :goto_5
  417. :catch_2
  418. move-exception p2
  419. if-nez p1, :cond_6
  420. move-object p1, p2
  421. :cond_6
  422. :goto_5
  423. :try_start_4
  424. iget-object p2, p0, Lokhttp3/internal/http2/Http2Connection;->socket:Ljava/net/Socket;
  425. invoke-virtual {p2}, Ljava/net/Socket;->close()V
  426. :try_end_4
  427. .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_3
  428. goto :goto_6
  429. :catch_3
  430. move-exception p1
  431. :goto_6
  432. if-nez p1, :cond_7
  433. return-void
  434. :cond_7
  435. throw p1
  436. :catchall_0
  437. move-exception p1
  438. :try_start_5
  439. monitor-exit p0
  440. :try_end_5
  441. .catchall {:try_start_5 .. :try_end_5} :catchall_0
  442. goto :goto_8
  443. :goto_7
  444. throw p1
  445. :goto_8
  446. goto :goto_7
  447. .end method
  448. .method public flush()V
  449. .locals 1
  450. .annotation system Ldalvik/annotation/Throws;
  451. value = {
  452. Ljava/io/IOException;
  453. }
  454. .end annotation
  455. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  456. invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Writer;->flush()V
  457. return-void
  458. .end method
  459. .method public getProtocol()Lokhttp3/Protocol;
  460. .locals 1
  461. sget-object v0, Lokhttp3/Protocol;->HTTP_2:Lokhttp3/Protocol;
  462. return-object v0
  463. .end method
  464. .method declared-synchronized getStream(I)Lokhttp3/internal/http2/Http2Stream;
  465. .locals 1
  466. monitor-enter p0
  467. :try_start_0
  468. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->streams:Ljava/util/Map;
  469. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  470. move-result-object p1
  471. invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
  472. move-result-object p1
  473. check-cast p1, Lokhttp3/internal/http2/Http2Stream;
  474. :try_end_0
  475. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  476. monitor-exit p0
  477. return-object p1
  478. :catchall_0
  479. move-exception p1
  480. monitor-exit p0
  481. throw p1
  482. .end method
  483. .method public declared-synchronized isShutdown()Z
  484. .locals 1
  485. monitor-enter p0
  486. :try_start_0
  487. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Connection;->shutdown:Z
  488. :try_end_0
  489. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  490. monitor-exit p0
  491. return v0
  492. :catchall_0
  493. move-exception v0
  494. monitor-exit p0
  495. throw v0
  496. .end method
  497. .method public declared-synchronized maxConcurrentStreams()I
  498. .locals 2
  499. monitor-enter p0
  500. :try_start_0
  501. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->peerSettings:Lokhttp3/internal/http2/Settings;
  502. const v1, 0x7fffffff
  503. invoke-virtual {v0, v1}, Lokhttp3/internal/http2/Settings;->getMaxConcurrentStreams(I)I
  504. move-result v0
  505. :try_end_0
  506. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  507. monitor-exit p0
  508. return v0
  509. :catchall_0
  510. move-exception v0
  511. monitor-exit p0
  512. throw v0
  513. .end method
  514. .method public newStream(Ljava/util/List;Z)Lokhttp3/internal/http2/Http2Stream;
  515. .locals 1
  516. .annotation system Ldalvik/annotation/Signature;
  517. value = {
  518. "(",
  519. "Ljava/util/List<",
  520. "Lokhttp3/internal/http2/Header;",
  521. ">;Z)",
  522. "Lokhttp3/internal/http2/Http2Stream;"
  523. }
  524. .end annotation
  525. .annotation system Ldalvik/annotation/Throws;
  526. value = {
  527. Ljava/io/IOException;
  528. }
  529. .end annotation
  530. const/4 v0, 0x0
  531. invoke-direct {p0, v0, p1, p2}, Lokhttp3/internal/http2/Http2Connection;->newStream(ILjava/util/List;Z)Lokhttp3/internal/http2/Http2Stream;
  532. move-result-object p1
  533. return-object p1
  534. .end method
  535. .method public declared-synchronized openStreamCount()I
  536. .locals 1
  537. monitor-enter p0
  538. :try_start_0
  539. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->streams:Ljava/util/Map;
  540. invoke-interface {v0}, Ljava/util/Map;->size()I
  541. move-result v0
  542. :try_end_0
  543. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  544. monitor-exit p0
  545. return v0
  546. :catchall_0
  547. move-exception v0
  548. monitor-exit p0
  549. throw v0
  550. .end method
  551. .method public ping()Lokhttp3/internal/http2/Ping;
  552. .locals 4
  553. .annotation system Ldalvik/annotation/Throws;
  554. value = {
  555. Ljava/io/IOException;
  556. }
  557. .end annotation
  558. new-instance v0, Lokhttp3/internal/http2/Ping;
  559. invoke-direct {v0}, Lokhttp3/internal/http2/Ping;-><init>()V
  560. monitor-enter p0
  561. :try_start_0
  562. iget-boolean v1, p0, Lokhttp3/internal/http2/Http2Connection;->shutdown:Z
  563. if-nez v1, :cond_1
  564. iget v1, p0, Lokhttp3/internal/http2/Http2Connection;->nextPingId:I
  565. iget v2, p0, Lokhttp3/internal/http2/Http2Connection;->nextPingId:I
  566. add-int/lit8 v2, v2, 0x2
  567. iput v2, p0, Lokhttp3/internal/http2/Http2Connection;->nextPingId:I
  568. iget-object v2, p0, Lokhttp3/internal/http2/Http2Connection;->pings:Ljava/util/Map;
  569. if-nez v2, :cond_0
  570. new-instance v2, Ljava/util/LinkedHashMap;
  571. invoke-direct {v2}, Ljava/util/LinkedHashMap;-><init>()V
  572. iput-object v2, p0, Lokhttp3/internal/http2/Http2Connection;->pings:Ljava/util/Map;
  573. :cond_0
  574. iget-object v2, p0, Lokhttp3/internal/http2/Http2Connection;->pings:Ljava/util/Map;
  575. invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  576. move-result-object v3
  577. invoke-interface {v2, v3, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
  578. monitor-exit p0
  579. :try_end_0
  580. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  581. const/4 v2, 0x0
  582. const v3, 0x4f4b6f6b
  583. invoke-virtual {p0, v2, v1, v3, v0}, Lokhttp3/internal/http2/Http2Connection;->writePing(ZIILokhttp3/internal/http2/Ping;)V
  584. return-object v0
  585. :cond_1
  586. :try_start_1
  587. new-instance v0, Lokhttp3/internal/http2/ConnectionShutdownException;
  588. invoke-direct {v0}, Lokhttp3/internal/http2/ConnectionShutdownException;-><init>()V
  589. throw v0
  590. :catchall_0
  591. move-exception v0
  592. monitor-exit p0
  593. :try_end_1
  594. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  595. throw v0
  596. .end method
  597. .method pushDataLater(ILokio/BufferedSource;IZ)V
  598. .locals 9
  599. .annotation system Ldalvik/annotation/Throws;
  600. value = {
  601. Ljava/io/IOException;
  602. }
  603. .end annotation
  604. new-instance v5, Lokio/Buffer;
  605. invoke-direct {v5}, Lokio/Buffer;-><init>()V
  606. int-to-long v0, p3
  607. invoke-interface {p2, v0, v1}, Lokio/BufferedSource;->require(J)V
  608. invoke-interface {p2, v5, v0, v1}, Lokio/Source;->read(Lokio/Buffer;J)J
  609. invoke-virtual {v5}, Lokio/Buffer;->size()J
  610. move-result-wide v2
  611. cmp-long p2, v2, v0
  612. if-nez p2, :cond_0
  613. iget-object p2, p0, Lokhttp3/internal/http2/Http2Connection;->pushExecutor:Ljava/util/concurrent/ExecutorService;
  614. new-instance v8, Lokhttp3/internal/http2/Http2Connection$6;
  615. const/4 v0, 0x2
  616. new-array v3, v0, [Ljava/lang/Object;
  617. const/4 v0, 0x0
  618. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->hostname:Ljava/lang/String;
  619. aput-object v1, v3, v0
  620. const/4 v0, 0x1
  621. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  622. move-result-object v1
  623. aput-object v1, v3, v0
  624. const-string v2, "OkHttp %s Push Data[%s]"
  625. move-object v0, v8
  626. move-object v1, p0
  627. move v4, p1
  628. move v6, p3
  629. move v7, p4
  630. invoke-direct/range {v0 .. v7}, Lokhttp3/internal/http2/Http2Connection$6;-><init>(Lokhttp3/internal/http2/Http2Connection;Ljava/lang/String;[Ljava/lang/Object;ILokio/Buffer;IZ)V
  631. invoke-interface {p2, v8}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
  632. return-void
  633. :cond_0
  634. new-instance p1, Ljava/io/IOException;
  635. new-instance p2, Ljava/lang/StringBuilder;
  636. invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
  637. invoke-virtual {v5}, Lokio/Buffer;->size()J
  638. move-result-wide v0
  639. invoke-virtual {p2, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
  640. const-string p4, " != "
  641. invoke-virtual {p2, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  642. invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  643. invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  644. move-result-object p2
  645. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  646. throw p1
  647. .end method
  648. .method pushHeadersLater(ILjava/util/List;Z)V
  649. .locals 9
  650. .annotation system Ldalvik/annotation/Signature;
  651. value = {
  652. "(I",
  653. "Ljava/util/List<",
  654. "Lokhttp3/internal/http2/Header;",
  655. ">;Z)V"
  656. }
  657. .end annotation
  658. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->pushExecutor:Ljava/util/concurrent/ExecutorService;
  659. new-instance v8, Lokhttp3/internal/http2/Http2Connection$5;
  660. const/4 v1, 0x2
  661. new-array v4, v1, [Ljava/lang/Object;
  662. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->hostname:Ljava/lang/String;
  663. const/4 v2, 0x0
  664. aput-object v1, v4, v2
  665. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  666. move-result-object v1
  667. const/4 v2, 0x1
  668. aput-object v1, v4, v2
  669. const-string v3, "OkHttp %s Push Headers[%s]"
  670. move-object v1, v8
  671. move-object v2, p0
  672. move v5, p1
  673. move-object v6, p2
  674. move v7, p3
  675. invoke-direct/range {v1 .. v7}, Lokhttp3/internal/http2/Http2Connection$5;-><init>(Lokhttp3/internal/http2/Http2Connection;Ljava/lang/String;[Ljava/lang/Object;ILjava/util/List;Z)V
  676. invoke-interface {v0, v8}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
  677. return-void
  678. .end method
  679. .method pushRequestLater(ILjava/util/List;)V
  680. .locals 8
  681. .annotation system Ldalvik/annotation/Signature;
  682. value = {
  683. "(I",
  684. "Ljava/util/List<",
  685. "Lokhttp3/internal/http2/Header;",
  686. ">;)V"
  687. }
  688. .end annotation
  689. monitor-enter p0
  690. :try_start_0
  691. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->currentPushRequests:Ljava/util/Set;
  692. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  693. move-result-object v1
  694. invoke-interface {v0, v1}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z
  695. move-result v0
  696. if-eqz v0, :cond_0
  697. sget-object p2, Lokhttp3/internal/http2/ErrorCode;->PROTOCOL_ERROR:Lokhttp3/internal/http2/ErrorCode;
  698. invoke-virtual {p0, p1, p2}, Lokhttp3/internal/http2/Http2Connection;->writeSynResetLater(ILokhttp3/internal/http2/ErrorCode;)V
  699. monitor-exit p0
  700. return-void
  701. :cond_0
  702. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->currentPushRequests:Ljava/util/Set;
  703. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  704. move-result-object v1
  705. invoke-interface {v0, v1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
  706. monitor-exit p0
  707. :try_end_0
  708. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  709. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->pushExecutor:Ljava/util/concurrent/ExecutorService;
  710. new-instance v7, Lokhttp3/internal/http2/Http2Connection$4;
  711. const/4 v1, 0x2
  712. new-array v4, v1, [Ljava/lang/Object;
  713. const/4 v1, 0x0
  714. iget-object v2, p0, Lokhttp3/internal/http2/Http2Connection;->hostname:Ljava/lang/String;
  715. aput-object v2, v4, v1
  716. const/4 v1, 0x1
  717. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  718. move-result-object v2
  719. aput-object v2, v4, v1
  720. const-string v3, "OkHttp %s Push Request[%s]"
  721. move-object v1, v7
  722. move-object v2, p0
  723. move v5, p1
  724. move-object v6, p2
  725. invoke-direct/range {v1 .. v6}, Lokhttp3/internal/http2/Http2Connection$4;-><init>(Lokhttp3/internal/http2/Http2Connection;Ljava/lang/String;[Ljava/lang/Object;ILjava/util/List;)V
  726. invoke-interface {v0, v7}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
  727. return-void
  728. :catchall_0
  729. move-exception p1
  730. :try_start_1
  731. monitor-exit p0
  732. :try_end_1
  733. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  734. throw p1
  735. .end method
  736. .method pushResetLater(ILokhttp3/internal/http2/ErrorCode;)V
  737. .locals 8
  738. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->pushExecutor:Ljava/util/concurrent/ExecutorService;
  739. new-instance v7, Lokhttp3/internal/http2/Http2Connection$7;
  740. const/4 v1, 0x2
  741. new-array v4, v1, [Ljava/lang/Object;
  742. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->hostname:Ljava/lang/String;
  743. const/4 v2, 0x0
  744. aput-object v1, v4, v2
  745. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  746. move-result-object v1
  747. const/4 v2, 0x1
  748. aput-object v1, v4, v2
  749. const-string v3, "OkHttp %s Push Reset[%s]"
  750. move-object v1, v7
  751. move-object v2, p0
  752. move v5, p1
  753. move-object v6, p2
  754. invoke-direct/range {v1 .. v6}, Lokhttp3/internal/http2/Http2Connection$7;-><init>(Lokhttp3/internal/http2/Http2Connection;Ljava/lang/String;[Ljava/lang/Object;ILokhttp3/internal/http2/ErrorCode;)V
  755. invoke-interface {v0, v7}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
  756. return-void
  757. .end method
  758. .method public pushStream(ILjava/util/List;Z)Lokhttp3/internal/http2/Http2Stream;
  759. .locals 1
  760. .annotation system Ldalvik/annotation/Signature;
  761. value = {
  762. "(I",
  763. "Ljava/util/List<",
  764. "Lokhttp3/internal/http2/Header;",
  765. ">;Z)",
  766. "Lokhttp3/internal/http2/Http2Stream;"
  767. }
  768. .end annotation
  769. .annotation system Ldalvik/annotation/Throws;
  770. value = {
  771. Ljava/io/IOException;
  772. }
  773. .end annotation
  774. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Connection;->client:Z
  775. if-nez v0, :cond_0
  776. invoke-direct {p0, p1, p2, p3}, Lokhttp3/internal/http2/Http2Connection;->newStream(ILjava/util/List;Z)Lokhttp3/internal/http2/Http2Stream;
  777. move-result-object p1
  778. return-object p1
  779. :cond_0
  780. new-instance p1, Ljava/lang/IllegalStateException;
  781. const-string p2, "Client cannot push requests."
  782. invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  783. throw p1
  784. .end method
  785. .method pushedStream(I)Z
  786. .locals 1
  787. const/4 v0, 0x1
  788. if-eqz p1, :cond_0
  789. and-int/2addr p1, v0
  790. if-nez p1, :cond_0
  791. goto :goto_0
  792. :cond_0
  793. const/4 v0, 0x0
  794. :goto_0
  795. return v0
  796. .end method
  797. .method declared-synchronized removePing(I)Lokhttp3/internal/http2/Ping;
  798. .locals 1
  799. monitor-enter p0
  800. :try_start_0
  801. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->pings:Ljava/util/Map;
  802. if-eqz v0, :cond_0
  803. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->pings:Ljava/util/Map;
  804. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  805. move-result-object p1
  806. invoke-interface {v0, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
  807. move-result-object p1
  808. check-cast p1, Lokhttp3/internal/http2/Ping;
  809. :try_end_0
  810. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  811. goto :goto_0
  812. :cond_0
  813. const/4 p1, 0x0
  814. :goto_0
  815. monitor-exit p0
  816. return-object p1
  817. :catchall_0
  818. move-exception p1
  819. monitor-exit p0
  820. throw p1
  821. .end method
  822. .method declared-synchronized removeStream(I)Lokhttp3/internal/http2/Http2Stream;
  823. .locals 1
  824. monitor-enter p0
  825. :try_start_0
  826. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->streams:Ljava/util/Map;
  827. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  828. move-result-object p1
  829. invoke-interface {v0, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
  830. move-result-object p1
  831. check-cast p1, Lokhttp3/internal/http2/Http2Stream;
  832. invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
  833. :try_end_0
  834. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  835. monitor-exit p0
  836. return-object p1
  837. :catchall_0
  838. move-exception p1
  839. monitor-exit p0
  840. throw p1
  841. .end method
  842. .method public setSettings(Lokhttp3/internal/http2/Settings;)V
  843. .locals 2
  844. .annotation system Ldalvik/annotation/Throws;
  845. value = {
  846. Ljava/io/IOException;
  847. }
  848. .end annotation
  849. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  850. monitor-enter v0
  851. :try_start_0
  852. monitor-enter p0
  853. :try_end_0
  854. .catchall {:try_start_0 .. :try_end_0} :catchall_1
  855. :try_start_1
  856. iget-boolean v1, p0, Lokhttp3/internal/http2/Http2Connection;->shutdown:Z
  857. if-nez v1, :cond_0
  858. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->okHttpSettings:Lokhttp3/internal/http2/Settings;
  859. invoke-virtual {v1, p1}, Lokhttp3/internal/http2/Settings;->merge(Lokhttp3/internal/http2/Settings;)V
  860. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  861. invoke-virtual {v1, p1}, Lokhttp3/internal/http2/Http2Writer;->settings(Lokhttp3/internal/http2/Settings;)V
  862. monitor-exit p0
  863. :try_end_1
  864. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  865. :try_start_2
  866. monitor-exit v0
  867. :try_end_2
  868. .catchall {:try_start_2 .. :try_end_2} :catchall_1
  869. return-void
  870. :cond_0
  871. :try_start_3
  872. new-instance p1, Lokhttp3/internal/http2/ConnectionShutdownException;
  873. invoke-direct {p1}, Lokhttp3/internal/http2/ConnectionShutdownException;-><init>()V
  874. throw p1
  875. :catchall_0
  876. move-exception p1
  877. monitor-exit p0
  878. :try_end_3
  879. .catchall {:try_start_3 .. :try_end_3} :catchall_0
  880. :try_start_4
  881. throw p1
  882. :catchall_1
  883. move-exception p1
  884. monitor-exit v0
  885. :try_end_4
  886. .catchall {:try_start_4 .. :try_end_4} :catchall_1
  887. throw p1
  888. .end method
  889. .method public shutdown(Lokhttp3/internal/http2/ErrorCode;)V
  890. .locals 4
  891. .annotation system Ldalvik/annotation/Throws;
  892. value = {
  893. Ljava/io/IOException;
  894. }
  895. .end annotation
  896. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  897. monitor-enter v0
  898. :try_start_0
  899. monitor-enter p0
  900. :try_end_0
  901. .catchall {:try_start_0 .. :try_end_0} :catchall_1
  902. :try_start_1
  903. iget-boolean v1, p0, Lokhttp3/internal/http2/Http2Connection;->shutdown:Z
  904. if-eqz v1, :cond_0
  905. monitor-exit p0
  906. :try_end_1
  907. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  908. :try_start_2
  909. monitor-exit v0
  910. :try_end_2
  911. .catchall {:try_start_2 .. :try_end_2} :catchall_1
  912. return-void
  913. :cond_0
  914. const/4 v1, 0x1
  915. :try_start_3
  916. iput-boolean v1, p0, Lokhttp3/internal/http2/Http2Connection;->shutdown:Z
  917. iget v1, p0, Lokhttp3/internal/http2/Http2Connection;->lastGoodStreamId:I
  918. monitor-exit p0
  919. :try_end_3
  920. .catchall {:try_start_3 .. :try_end_3} :catchall_0
  921. :try_start_4
  922. iget-object v2, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  923. sget-object v3, Lokhttp3/internal/Util;->EMPTY_BYTE_ARRAY:[B
  924. invoke-virtual {v2, v1, p1, v3}, Lokhttp3/internal/http2/Http2Writer;->goAway(ILokhttp3/internal/http2/ErrorCode;[B)V
  925. monitor-exit v0
  926. :try_end_4
  927. .catchall {:try_start_4 .. :try_end_4} :catchall_1
  928. return-void
  929. :catchall_0
  930. move-exception p1
  931. :try_start_5
  932. monitor-exit p0
  933. :try_end_5
  934. .catchall {:try_start_5 .. :try_end_5} :catchall_0
  935. :try_start_6
  936. throw p1
  937. :catchall_1
  938. move-exception p1
  939. monitor-exit v0
  940. :try_end_6
  941. .catchall {:try_start_6 .. :try_end_6} :catchall_1
  942. throw p1
  943. .end method
  944. .method public start()V
  945. .locals 1
  946. .annotation system Ldalvik/annotation/Throws;
  947. value = {
  948. Ljava/io/IOException;
  949. }
  950. .end annotation
  951. const/4 v0, 0x1
  952. invoke-virtual {p0, v0}, Lokhttp3/internal/http2/Http2Connection;->start(Z)V
  953. return-void
  954. .end method
  955. .method start(Z)V
  956. .locals 5
  957. .annotation system Ldalvik/annotation/Throws;
  958. value = {
  959. Ljava/io/IOException;
  960. }
  961. .end annotation
  962. if-eqz p1, :cond_0
  963. iget-object p1, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  964. invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Writer;->connectionPreface()V
  965. iget-object p1, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  966. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->okHttpSettings:Lokhttp3/internal/http2/Settings;
  967. invoke-virtual {p1, v0}, Lokhttp3/internal/http2/Http2Writer;->settings(Lokhttp3/internal/http2/Settings;)V
  968. iget-object p1, p0, Lokhttp3/internal/http2/Http2Connection;->okHttpSettings:Lokhttp3/internal/http2/Settings;
  969. invoke-virtual {p1}, Lokhttp3/internal/http2/Settings;->getInitialWindowSize()I
  970. move-result p1
  971. const v0, 0xffff
  972. if-eq p1, v0, :cond_0
  973. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  974. const/4 v2, 0x0
  975. sub-int/2addr p1, v0
  976. int-to-long v3, p1
  977. invoke-virtual {v1, v2, v3, v4}, Lokhttp3/internal/http2/Http2Writer;->windowUpdate(IJ)V
  978. :cond_0
  979. new-instance p1, Ljava/lang/Thread;
  980. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->readerRunnable:Lokhttp3/internal/http2/Http2Connection$ReaderRunnable;
  981. invoke-direct {p1, v0}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V
  982. invoke-virtual {p1}, Ljava/lang/Thread;->start()V
  983. return-void
  984. .end method
  985. .method public writeData(IZLokio/Buffer;J)V
  986. .locals 8
  987. .annotation system Ldalvik/annotation/Throws;
  988. value = {
  989. Ljava/io/IOException;
  990. }
  991. .end annotation
  992. const/4 v0, 0x0
  993. const-wide/16 v1, 0x0
  994. cmp-long v3, p4, v1
  995. if-nez v3, :cond_0
  996. iget-object p4, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  997. invoke-virtual {p4, p2, p1, p3, v0}, Lokhttp3/internal/http2/Http2Writer;->data(ZILokio/Buffer;I)V
  998. return-void
  999. :cond_0
  1000. :goto_0
  1001. cmp-long v3, p4, v1
  1002. if-lez v3, :cond_4
  1003. monitor-enter p0
  1004. :goto_1
  1005. :try_start_0
  1006. iget-wide v3, p0, Lokhttp3/internal/http2/Http2Connection;->bytesLeftInWriteWindow:J
  1007. cmp-long v5, v3, v1
  1008. if-gtz v5, :cond_2
  1009. iget-object v3, p0, Lokhttp3/internal/http2/Http2Connection;->streams:Ljava/util/Map;
  1010. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  1011. move-result-object v4
  1012. invoke-interface {v3, v4}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
  1013. move-result v3
  1014. if-eqz v3, :cond_1
  1015. invoke-virtual {p0}, Ljava/lang/Object;->wait()V
  1016. goto :goto_1
  1017. :cond_1
  1018. new-instance p1, Ljava/io/IOException;
  1019. const-string p2, "stream closed"
  1020. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  1021. throw p1
  1022. :try_end_0
  1023. .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0
  1024. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  1025. :cond_2
  1026. :try_start_1
  1027. iget-wide v3, p0, Lokhttp3/internal/http2/Http2Connection;->bytesLeftInWriteWindow:J
  1028. invoke-static {p4, p5, v3, v4}, Ljava/lang/Math;->min(JJ)J
  1029. move-result-wide v3
  1030. long-to-int v4, v3
  1031. iget-object v3, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  1032. invoke-virtual {v3}, Lokhttp3/internal/http2/Http2Writer;->maxDataLength()I
  1033. move-result v3
  1034. invoke-static {v4, v3}, Ljava/lang/Math;->min(II)I
  1035. move-result v3
  1036. iget-wide v4, p0, Lokhttp3/internal/http2/Http2Connection;->bytesLeftInWriteWindow:J
  1037. int-to-long v6, v3
  1038. sub-long/2addr v4, v6
  1039. iput-wide v4, p0, Lokhttp3/internal/http2/Http2Connection;->bytesLeftInWriteWindow:J
  1040. monitor-exit p0
  1041. :try_end_1
  1042. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  1043. sub-long/2addr p4, v6
  1044. iget-object v4, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  1045. if-eqz p2, :cond_3
  1046. cmp-long v5, p4, v1
  1047. if-nez v5, :cond_3
  1048. const/4 v5, 0x1
  1049. goto :goto_2
  1050. :cond_3
  1051. const/4 v5, 0x0
  1052. :goto_2
  1053. invoke-virtual {v4, v5, p1, p3, v3}, Lokhttp3/internal/http2/Http2Writer;->data(ZILokio/Buffer;I)V
  1054. goto :goto_0
  1055. :catchall_0
  1056. move-exception p1
  1057. goto :goto_3
  1058. :catch_0
  1059. :try_start_2
  1060. new-instance p1, Ljava/io/InterruptedIOException;
  1061. invoke-direct {p1}, Ljava/io/InterruptedIOException;-><init>()V
  1062. throw p1
  1063. :goto_3
  1064. monitor-exit p0
  1065. :try_end_2
  1066. .catchall {:try_start_2 .. :try_end_2} :catchall_0
  1067. throw p1
  1068. :cond_4
  1069. return-void
  1070. .end method
  1071. .method writePing(ZIILokhttp3/internal/http2/Ping;)V
  1072. .locals 1
  1073. .annotation system Ldalvik/annotation/Throws;
  1074. value = {
  1075. Ljava/io/IOException;
  1076. }
  1077. .end annotation
  1078. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  1079. monitor-enter v0
  1080. if-eqz p4, :cond_0
  1081. :try_start_0
  1082. invoke-virtual {p4}, Lokhttp3/internal/http2/Ping;->send()V
  1083. :cond_0
  1084. iget-object p4, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  1085. invoke-virtual {p4, p1, p2, p3}, Lokhttp3/internal/http2/Http2Writer;->ping(ZII)V
  1086. monitor-exit v0
  1087. return-void
  1088. :catchall_0
  1089. move-exception p1
  1090. monitor-exit v0
  1091. :try_end_0
  1092. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  1093. throw p1
  1094. .end method
  1095. .method writePingLater(ZIILokhttp3/internal/http2/Ping;)V
  1096. .locals 10
  1097. sget-object v0, Lokhttp3/internal/http2/Http2Connection;->executor:Ljava/util/concurrent/ExecutorService;
  1098. new-instance v9, Lokhttp3/internal/http2/Http2Connection$3;
  1099. const/4 v1, 0x3
  1100. new-array v4, v1, [Ljava/lang/Object;
  1101. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->hostname:Ljava/lang/String;
  1102. const/4 v2, 0x0
  1103. aput-object v1, v4, v2
  1104. invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  1105. move-result-object v1
  1106. const/4 v2, 0x1
  1107. aput-object v1, v4, v2
  1108. invoke-static {p3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  1109. move-result-object v1
  1110. const/4 v2, 0x2
  1111. aput-object v1, v4, v2
  1112. const-string v3, "OkHttp %s ping %08x%08x"
  1113. move-object v1, v9
  1114. move-object v2, p0
  1115. move v5, p1
  1116. move v6, p2
  1117. move v7, p3
  1118. move-object v8, p4
  1119. invoke-direct/range {v1 .. v8}, Lokhttp3/internal/http2/Http2Connection$3;-><init>(Lokhttp3/internal/http2/Http2Connection;Ljava/lang/String;[Ljava/lang/Object;ZIILokhttp3/internal/http2/Ping;)V
  1120. invoke-interface {v0, v9}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
  1121. return-void
  1122. .end method
  1123. .method writeSynReply(IZLjava/util/List;)V
  1124. .locals 1
  1125. .annotation system Ldalvik/annotation/Signature;
  1126. value = {
  1127. "(IZ",
  1128. "Ljava/util/List<",
  1129. "Lokhttp3/internal/http2/Header;",
  1130. ">;)V"
  1131. }
  1132. .end annotation
  1133. .annotation system Ldalvik/annotation/Throws;
  1134. value = {
  1135. Ljava/io/IOException;
  1136. }
  1137. .end annotation
  1138. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  1139. invoke-virtual {v0, p2, p1, p3}, Lokhttp3/internal/http2/Http2Writer;->synReply(ZILjava/util/List;)V
  1140. return-void
  1141. .end method
  1142. .method writeSynReset(ILokhttp3/internal/http2/ErrorCode;)V
  1143. .locals 1
  1144. .annotation system Ldalvik/annotation/Throws;
  1145. value = {
  1146. Ljava/io/IOException;
  1147. }
  1148. .end annotation
  1149. iget-object v0, p0, Lokhttp3/internal/http2/Http2Connection;->writer:Lokhttp3/internal/http2/Http2Writer;
  1150. invoke-virtual {v0, p1, p2}, Lokhttp3/internal/http2/Http2Writer;->rstStream(ILokhttp3/internal/http2/ErrorCode;)V
  1151. return-void
  1152. .end method
  1153. .method writeSynResetLater(ILokhttp3/internal/http2/ErrorCode;)V
  1154. .locals 8
  1155. sget-object v0, Lokhttp3/internal/http2/Http2Connection;->executor:Ljava/util/concurrent/ExecutorService;
  1156. new-instance v7, Lokhttp3/internal/http2/Http2Connection$1;
  1157. const/4 v1, 0x2
  1158. new-array v4, v1, [Ljava/lang/Object;
  1159. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->hostname:Ljava/lang/String;
  1160. const/4 v2, 0x0
  1161. aput-object v1, v4, v2
  1162. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  1163. move-result-object v1
  1164. const/4 v2, 0x1
  1165. aput-object v1, v4, v2
  1166. const-string v3, "OkHttp %s stream %d"
  1167. move-object v1, v7
  1168. move-object v2, p0
  1169. move v5, p1
  1170. move-object v6, p2
  1171. invoke-direct/range {v1 .. v6}, Lokhttp3/internal/http2/Http2Connection$1;-><init>(Lokhttp3/internal/http2/Http2Connection;Ljava/lang/String;[Ljava/lang/Object;ILokhttp3/internal/http2/ErrorCode;)V
  1172. invoke-interface {v0, v7}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
  1173. return-void
  1174. .end method
  1175. .method writeWindowUpdateLater(IJ)V
  1176. .locals 9
  1177. sget-object v0, Lokhttp3/internal/http2/Http2Connection;->executor:Ljava/util/concurrent/ExecutorService;
  1178. new-instance v8, Lokhttp3/internal/http2/Http2Connection$2;
  1179. const/4 v1, 0x2
  1180. new-array v4, v1, [Ljava/lang/Object;
  1181. iget-object v1, p0, Lokhttp3/internal/http2/Http2Connection;->hostname:Ljava/lang/String;
  1182. const/4 v2, 0x0
  1183. aput-object v1, v4, v2
  1184. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  1185. move-result-object v1
  1186. const/4 v2, 0x1
  1187. aput-object v1, v4, v2
  1188. const-string v3, "OkHttp Window Update %s stream %d"
  1189. move-object v1, v8
  1190. move-object v2, p0
  1191. move v5, p1
  1192. move-wide v6, p2
  1193. invoke-direct/range {v1 .. v7}, Lokhttp3/internal/http2/Http2Connection$2;-><init>(Lokhttp3/internal/http2/Http2Connection;Ljava/lang/String;[Ljava/lang/Object;IJ)V
  1194. invoke-interface {v0, v8}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
  1195. return-void
  1196. .end method