Http2Stream.smali 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. .class public final Lokhttp3/internal/http2/Http2Stream;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/MemberClasses;
  6. value = {
  7. Lokhttp3/internal/http2/Http2Stream$StreamTimeout;,
  8. Lokhttp3/internal/http2/Http2Stream$FramingSink;,
  9. Lokhttp3/internal/http2/Http2Stream$FramingSource;
  10. }
  11. .end annotation
  12. # static fields
  13. .field static final synthetic $assertionsDisabled:Z
  14. # instance fields
  15. .field bytesLeftInWriteWindow:J
  16. .field final connection:Lokhttp3/internal/http2/Http2Connection;
  17. .field errorCode:Lokhttp3/internal/http2/ErrorCode;
  18. .field private hasResponseHeaders:Z
  19. .field final id:I
  20. .field final readTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  21. .field private final requestHeaders:Ljava/util/List;
  22. .annotation system Ldalvik/annotation/Signature;
  23. value = {
  24. "Ljava/util/List<",
  25. "Lokhttp3/internal/http2/Header;",
  26. ">;"
  27. }
  28. .end annotation
  29. .end field
  30. .field private responseHeaders:Ljava/util/List;
  31. .annotation system Ldalvik/annotation/Signature;
  32. value = {
  33. "Ljava/util/List<",
  34. "Lokhttp3/internal/http2/Header;",
  35. ">;"
  36. }
  37. .end annotation
  38. .end field
  39. .field final sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  40. .field private final source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  41. .field unacknowledgedBytesRead:J
  42. .field final writeTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  43. # direct methods
  44. .method static constructor <clinit>()V
  45. .locals 0
  46. return-void
  47. .end method
  48. .method constructor <init>(ILokhttp3/internal/http2/Http2Connection;ZZLjava/util/List;)V
  49. .locals 2
  50. .annotation system Ldalvik/annotation/Signature;
  51. value = {
  52. "(I",
  53. "Lokhttp3/internal/http2/Http2Connection;",
  54. "ZZ",
  55. "Ljava/util/List<",
  56. "Lokhttp3/internal/http2/Header;",
  57. ">;)V"
  58. }
  59. .end annotation
  60. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  61. const-wide/16 v0, 0x0
  62. iput-wide v0, p0, Lokhttp3/internal/http2/Http2Stream;->unacknowledgedBytesRead:J
  63. new-instance v0, Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  64. invoke-direct {v0, p0}, Lokhttp3/internal/http2/Http2Stream$StreamTimeout;-><init>(Lokhttp3/internal/http2/Http2Stream;)V
  65. iput-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->readTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  66. new-instance v0, Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  67. invoke-direct {v0, p0}, Lokhttp3/internal/http2/Http2Stream$StreamTimeout;-><init>(Lokhttp3/internal/http2/Http2Stream;)V
  68. iput-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->writeTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  69. const/4 v0, 0x0
  70. iput-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  71. if-eqz p2, :cond_1
  72. if-eqz p5, :cond_0
  73. iput p1, p0, Lokhttp3/internal/http2/Http2Stream;->id:I
  74. iput-object p2, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  75. iget-object p1, p2, Lokhttp3/internal/http2/Http2Connection;->peerSettings:Lokhttp3/internal/http2/Settings;
  76. invoke-virtual {p1}, Lokhttp3/internal/http2/Settings;->getInitialWindowSize()I
  77. move-result p1
  78. int-to-long v0, p1
  79. iput-wide v0, p0, Lokhttp3/internal/http2/Http2Stream;->bytesLeftInWriteWindow:J
  80. new-instance p1, Lokhttp3/internal/http2/Http2Stream$FramingSource;
  81. iget-object p2, p2, Lokhttp3/internal/http2/Http2Connection;->okHttpSettings:Lokhttp3/internal/http2/Settings;
  82. invoke-virtual {p2}, Lokhttp3/internal/http2/Settings;->getInitialWindowSize()I
  83. move-result p2
  84. int-to-long v0, p2
  85. invoke-direct {p1, p0, v0, v1}, Lokhttp3/internal/http2/Http2Stream$FramingSource;-><init>(Lokhttp3/internal/http2/Http2Stream;J)V
  86. iput-object p1, p0, Lokhttp3/internal/http2/Http2Stream;->source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  87. new-instance p1, Lokhttp3/internal/http2/Http2Stream$FramingSink;
  88. invoke-direct {p1, p0}, Lokhttp3/internal/http2/Http2Stream$FramingSink;-><init>(Lokhttp3/internal/http2/Http2Stream;)V
  89. iput-object p1, p0, Lokhttp3/internal/http2/Http2Stream;->sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  90. iget-object p1, p0, Lokhttp3/internal/http2/Http2Stream;->source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  91. iput-boolean p4, p1, Lokhttp3/internal/http2/Http2Stream$FramingSource;->finished:Z
  92. iget-object p1, p0, Lokhttp3/internal/http2/Http2Stream;->sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  93. iput-boolean p3, p1, Lokhttp3/internal/http2/Http2Stream$FramingSink;->finished:Z
  94. iput-object p5, p0, Lokhttp3/internal/http2/Http2Stream;->requestHeaders:Ljava/util/List;
  95. return-void
  96. :cond_0
  97. new-instance p1, Ljava/lang/NullPointerException;
  98. const-string p2, "requestHeaders == null"
  99. invoke-direct {p1, p2}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
  100. throw p1
  101. :cond_1
  102. new-instance p1, Ljava/lang/NullPointerException;
  103. const-string p2, "connection == null"
  104. invoke-direct {p1, p2}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
  105. throw p1
  106. .end method
  107. .method private closeInternal(Lokhttp3/internal/http2/ErrorCode;)Z
  108. .locals 2
  109. monitor-enter p0
  110. :try_start_0
  111. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  112. const/4 v1, 0x0
  113. if-eqz v0, :cond_0
  114. monitor-exit p0
  115. return v1
  116. :cond_0
  117. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  118. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->finished:Z
  119. if-eqz v0, :cond_1
  120. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  121. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSink;->finished:Z
  122. if-eqz v0, :cond_1
  123. monitor-exit p0
  124. return v1
  125. :cond_1
  126. iput-object p1, p0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  127. invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
  128. monitor-exit p0
  129. :try_end_0
  130. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  131. iget-object p1, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  132. iget v0, p0, Lokhttp3/internal/http2/Http2Stream;->id:I
  133. invoke-virtual {p1, v0}, Lokhttp3/internal/http2/Http2Connection;->removeStream(I)Lokhttp3/internal/http2/Http2Stream;
  134. const/4 p1, 0x1
  135. return p1
  136. :catchall_0
  137. move-exception p1
  138. :try_start_1
  139. monitor-exit p0
  140. :try_end_1
  141. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  142. throw p1
  143. .end method
  144. # virtual methods
  145. .method addBytesToWriteWindow(J)V
  146. .locals 3
  147. iget-wide v0, p0, Lokhttp3/internal/http2/Http2Stream;->bytesLeftInWriteWindow:J
  148. add-long/2addr v0, p1
  149. iput-wide v0, p0, Lokhttp3/internal/http2/Http2Stream;->bytesLeftInWriteWindow:J
  150. const-wide/16 v0, 0x0
  151. cmp-long v2, p1, v0
  152. if-lez v2, :cond_0
  153. invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
  154. :cond_0
  155. return-void
  156. .end method
  157. .method cancelStreamIfNecessary()V
  158. .locals 2
  159. .annotation system Ldalvik/annotation/Throws;
  160. value = {
  161. Ljava/io/IOException;
  162. }
  163. .end annotation
  164. monitor-enter p0
  165. :try_start_0
  166. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  167. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->finished:Z
  168. if-nez v0, :cond_1
  169. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  170. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->closed:Z
  171. if-eqz v0, :cond_1
  172. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  173. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSink;->finished:Z
  174. if-nez v0, :cond_0
  175. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  176. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSink;->closed:Z
  177. if-eqz v0, :cond_1
  178. :cond_0
  179. const/4 v0, 0x1
  180. goto :goto_0
  181. :cond_1
  182. const/4 v0, 0x0
  183. :goto_0
  184. invoke-virtual {p0}, Lokhttp3/internal/http2/Http2Stream;->isOpen()Z
  185. move-result v1
  186. monitor-exit p0
  187. :try_end_0
  188. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  189. if-eqz v0, :cond_2
  190. sget-object v0, Lokhttp3/internal/http2/ErrorCode;->CANCEL:Lokhttp3/internal/http2/ErrorCode;
  191. invoke-virtual {p0, v0}, Lokhttp3/internal/http2/Http2Stream;->close(Lokhttp3/internal/http2/ErrorCode;)V
  192. goto :goto_1
  193. :cond_2
  194. if-nez v1, :cond_3
  195. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  196. iget v1, p0, Lokhttp3/internal/http2/Http2Stream;->id:I
  197. invoke-virtual {v0, v1}, Lokhttp3/internal/http2/Http2Connection;->removeStream(I)Lokhttp3/internal/http2/Http2Stream;
  198. :cond_3
  199. :goto_1
  200. return-void
  201. :catchall_0
  202. move-exception v0
  203. :try_start_1
  204. monitor-exit p0
  205. :try_end_1
  206. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  207. throw v0
  208. .end method
  209. .method checkOutNotClosed()V
  210. .locals 2
  211. .annotation system Ldalvik/annotation/Throws;
  212. value = {
  213. Ljava/io/IOException;
  214. }
  215. .end annotation
  216. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  217. iget-boolean v1, v0, Lokhttp3/internal/http2/Http2Stream$FramingSink;->closed:Z
  218. if-nez v1, :cond_2
  219. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSink;->finished:Z
  220. if-nez v0, :cond_1
  221. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  222. if-nez v0, :cond_0
  223. return-void
  224. :cond_0
  225. new-instance v1, Lokhttp3/internal/http2/StreamResetException;
  226. invoke-direct {v1, v0}, Lokhttp3/internal/http2/StreamResetException;-><init>(Lokhttp3/internal/http2/ErrorCode;)V
  227. throw v1
  228. :cond_1
  229. new-instance v0, Ljava/io/IOException;
  230. const-string v1, "stream finished"
  231. invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  232. throw v0
  233. :cond_2
  234. new-instance v0, Ljava/io/IOException;
  235. const-string v1, "stream closed"
  236. invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  237. throw v0
  238. .end method
  239. .method public close(Lokhttp3/internal/http2/ErrorCode;)V
  240. .locals 2
  241. .annotation system Ldalvik/annotation/Throws;
  242. value = {
  243. Ljava/io/IOException;
  244. }
  245. .end annotation
  246. invoke-direct {p0, p1}, Lokhttp3/internal/http2/Http2Stream;->closeInternal(Lokhttp3/internal/http2/ErrorCode;)Z
  247. move-result v0
  248. if-nez v0, :cond_0
  249. return-void
  250. :cond_0
  251. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  252. iget v1, p0, Lokhttp3/internal/http2/Http2Stream;->id:I
  253. invoke-virtual {v0, v1, p1}, Lokhttp3/internal/http2/Http2Connection;->writeSynReset(ILokhttp3/internal/http2/ErrorCode;)V
  254. return-void
  255. .end method
  256. .method public closeLater(Lokhttp3/internal/http2/ErrorCode;)V
  257. .locals 2
  258. invoke-direct {p0, p1}, Lokhttp3/internal/http2/Http2Stream;->closeInternal(Lokhttp3/internal/http2/ErrorCode;)Z
  259. move-result v0
  260. if-nez v0, :cond_0
  261. return-void
  262. :cond_0
  263. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  264. iget v1, p0, Lokhttp3/internal/http2/Http2Stream;->id:I
  265. invoke-virtual {v0, v1, p1}, Lokhttp3/internal/http2/Http2Connection;->writeSynResetLater(ILokhttp3/internal/http2/ErrorCode;)V
  266. return-void
  267. .end method
  268. .method public getConnection()Lokhttp3/internal/http2/Http2Connection;
  269. .locals 1
  270. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  271. return-object v0
  272. .end method
  273. .method public declared-synchronized getErrorCode()Lokhttp3/internal/http2/ErrorCode;
  274. .locals 1
  275. monitor-enter p0
  276. :try_start_0
  277. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  278. :try_end_0
  279. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  280. monitor-exit p0
  281. return-object v0
  282. :catchall_0
  283. move-exception v0
  284. monitor-exit p0
  285. throw v0
  286. .end method
  287. .method public getId()I
  288. .locals 1
  289. iget v0, p0, Lokhttp3/internal/http2/Http2Stream;->id:I
  290. return v0
  291. .end method
  292. .method public getRequestHeaders()Ljava/util/List;
  293. .locals 1
  294. .annotation system Ldalvik/annotation/Signature;
  295. value = {
  296. "()",
  297. "Ljava/util/List<",
  298. "Lokhttp3/internal/http2/Header;",
  299. ">;"
  300. }
  301. .end annotation
  302. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->requestHeaders:Ljava/util/List;
  303. return-object v0
  304. .end method
  305. .method public getSink()Lokio/Sink;
  306. .locals 2
  307. monitor-enter p0
  308. :try_start_0
  309. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Stream;->hasResponseHeaders:Z
  310. if-nez v0, :cond_1
  311. invoke-virtual {p0}, Lokhttp3/internal/http2/Http2Stream;->isLocallyInitiated()Z
  312. move-result v0
  313. if-eqz v0, :cond_0
  314. goto :goto_0
  315. :cond_0
  316. new-instance v0, Ljava/lang/IllegalStateException;
  317. const-string v1, "reply before requesting the sink"
  318. invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  319. throw v0
  320. :cond_1
  321. :goto_0
  322. monitor-exit p0
  323. :try_end_0
  324. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  325. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  326. return-object v0
  327. :catchall_0
  328. move-exception v0
  329. :try_start_1
  330. monitor-exit p0
  331. :try_end_1
  332. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  333. throw v0
  334. .end method
  335. .method public getSource()Lokio/Source;
  336. .locals 1
  337. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  338. return-object v0
  339. .end method
  340. .method public isLocallyInitiated()Z
  341. .locals 4
  342. iget v0, p0, Lokhttp3/internal/http2/Http2Stream;->id:I
  343. const/4 v1, 0x1
  344. and-int/2addr v0, v1
  345. const/4 v2, 0x0
  346. if-ne v0, v1, :cond_0
  347. const/4 v0, 0x1
  348. goto :goto_0
  349. :cond_0
  350. const/4 v0, 0x0
  351. :goto_0
  352. iget-object v3, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  353. iget-boolean v3, v3, Lokhttp3/internal/http2/Http2Connection;->client:Z
  354. if-ne v3, v0, :cond_1
  355. goto :goto_1
  356. :cond_1
  357. const/4 v1, 0x0
  358. :goto_1
  359. return v1
  360. .end method
  361. .method public declared-synchronized isOpen()Z
  362. .locals 2
  363. monitor-enter p0
  364. :try_start_0
  365. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  366. :try_end_0
  367. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  368. const/4 v1, 0x0
  369. if-eqz v0, :cond_0
  370. monitor-exit p0
  371. return v1
  372. :cond_0
  373. :try_start_1
  374. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  375. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->finished:Z
  376. if-nez v0, :cond_1
  377. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  378. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->closed:Z
  379. if-eqz v0, :cond_3
  380. :cond_1
  381. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  382. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSink;->finished:Z
  383. if-nez v0, :cond_2
  384. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  385. iget-boolean v0, v0, Lokhttp3/internal/http2/Http2Stream$FramingSink;->closed:Z
  386. if-eqz v0, :cond_3
  387. :cond_2
  388. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Stream;->hasResponseHeaders:Z
  389. :try_end_1
  390. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  391. if-eqz v0, :cond_3
  392. monitor-exit p0
  393. return v1
  394. :cond_3
  395. const/4 v0, 0x1
  396. monitor-exit p0
  397. return v0
  398. :catchall_0
  399. move-exception v0
  400. monitor-exit p0
  401. throw v0
  402. .end method
  403. .method public readTimeout()Lokio/Timeout;
  404. .locals 1
  405. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->readTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  406. return-object v0
  407. .end method
  408. .method receiveData(Lokio/BufferedSource;I)V
  409. .locals 3
  410. .annotation system Ldalvik/annotation/Throws;
  411. value = {
  412. Ljava/io/IOException;
  413. }
  414. .end annotation
  415. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  416. int-to-long v1, p2
  417. invoke-virtual {v0, p1, v1, v2}, Lokhttp3/internal/http2/Http2Stream$FramingSource;->receive(Lokio/BufferedSource;J)V
  418. return-void
  419. .end method
  420. .method receiveFin()V
  421. .locals 2
  422. monitor-enter p0
  423. :try_start_0
  424. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->source:Lokhttp3/internal/http2/Http2Stream$FramingSource;
  425. const/4 v1, 0x1
  426. iput-boolean v1, v0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->finished:Z
  427. invoke-virtual {p0}, Lokhttp3/internal/http2/Http2Stream;->isOpen()Z
  428. move-result v0
  429. invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
  430. monitor-exit p0
  431. :try_end_0
  432. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  433. if-nez v0, :cond_0
  434. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  435. iget v1, p0, Lokhttp3/internal/http2/Http2Stream;->id:I
  436. invoke-virtual {v0, v1}, Lokhttp3/internal/http2/Http2Connection;->removeStream(I)Lokhttp3/internal/http2/Http2Stream;
  437. :cond_0
  438. return-void
  439. :catchall_0
  440. move-exception v0
  441. :try_start_1
  442. monitor-exit p0
  443. :try_end_1
  444. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  445. throw v0
  446. .end method
  447. .method receiveHeaders(Ljava/util/List;)V
  448. .locals 3
  449. .annotation system Ldalvik/annotation/Signature;
  450. value = {
  451. "(",
  452. "Ljava/util/List<",
  453. "Lokhttp3/internal/http2/Header;",
  454. ">;)V"
  455. }
  456. .end annotation
  457. monitor-enter p0
  458. const/4 v0, 0x1
  459. :try_start_0
  460. iput-boolean v0, p0, Lokhttp3/internal/http2/Http2Stream;->hasResponseHeaders:Z
  461. iget-object v1, p0, Lokhttp3/internal/http2/Http2Stream;->responseHeaders:Ljava/util/List;
  462. if-nez v1, :cond_0
  463. iput-object p1, p0, Lokhttp3/internal/http2/Http2Stream;->responseHeaders:Ljava/util/List;
  464. invoke-virtual {p0}, Lokhttp3/internal/http2/Http2Stream;->isOpen()Z
  465. move-result v0
  466. invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
  467. goto :goto_0
  468. :cond_0
  469. new-instance v1, Ljava/util/ArrayList;
  470. invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
  471. iget-object v2, p0, Lokhttp3/internal/http2/Http2Stream;->responseHeaders:Ljava/util/List;
  472. invoke-interface {v1, v2}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z
  473. const/4 v2, 0x0
  474. invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  475. invoke-interface {v1, p1}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z
  476. iput-object v1, p0, Lokhttp3/internal/http2/Http2Stream;->responseHeaders:Ljava/util/List;
  477. :goto_0
  478. monitor-exit p0
  479. :try_end_0
  480. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  481. if-nez v0, :cond_1
  482. iget-object p1, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  483. iget v0, p0, Lokhttp3/internal/http2/Http2Stream;->id:I
  484. invoke-virtual {p1, v0}, Lokhttp3/internal/http2/Http2Connection;->removeStream(I)Lokhttp3/internal/http2/Http2Stream;
  485. :cond_1
  486. return-void
  487. :catchall_0
  488. move-exception p1
  489. :try_start_1
  490. monitor-exit p0
  491. :try_end_1
  492. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  493. throw p1
  494. .end method
  495. .method declared-synchronized receiveRstStream(Lokhttp3/internal/http2/ErrorCode;)V
  496. .locals 1
  497. monitor-enter p0
  498. :try_start_0
  499. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  500. if-nez v0, :cond_0
  501. iput-object p1, p0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  502. invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
  503. :try_end_0
  504. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  505. :cond_0
  506. monitor-exit p0
  507. return-void
  508. :catchall_0
  509. move-exception p1
  510. monitor-exit p0
  511. throw p1
  512. .end method
  513. .method public sendResponseHeaders(Ljava/util/List;Z)V
  514. .locals 2
  515. .annotation system Ldalvik/annotation/Signature;
  516. value = {
  517. "(",
  518. "Ljava/util/List<",
  519. "Lokhttp3/internal/http2/Header;",
  520. ">;Z)V"
  521. }
  522. .end annotation
  523. .annotation system Ldalvik/annotation/Throws;
  524. value = {
  525. Ljava/io/IOException;
  526. }
  527. .end annotation
  528. if-eqz p1, :cond_2
  529. const/4 v0, 0x0
  530. monitor-enter p0
  531. const/4 v1, 0x1
  532. :try_start_0
  533. iput-boolean v1, p0, Lokhttp3/internal/http2/Http2Stream;->hasResponseHeaders:Z
  534. if-nez p2, :cond_0
  535. iget-object p2, p0, Lokhttp3/internal/http2/Http2Stream;->sink:Lokhttp3/internal/http2/Http2Stream$FramingSink;
  536. iput-boolean v1, p2, Lokhttp3/internal/http2/Http2Stream$FramingSink;->finished:Z
  537. const/4 v0, 0x1
  538. :cond_0
  539. monitor-exit p0
  540. :try_end_0
  541. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  542. iget-object p2, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  543. iget v1, p0, Lokhttp3/internal/http2/Http2Stream;->id:I
  544. invoke-virtual {p2, v1, v0, p1}, Lokhttp3/internal/http2/Http2Connection;->writeSynReply(IZLjava/util/List;)V
  545. if-eqz v0, :cond_1
  546. iget-object p1, p0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
  547. invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Connection;->flush()V
  548. :cond_1
  549. return-void
  550. :catchall_0
  551. move-exception p1
  552. :try_start_1
  553. monitor-exit p0
  554. :try_end_1
  555. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  556. throw p1
  557. :cond_2
  558. new-instance p1, Ljava/lang/NullPointerException;
  559. const-string p2, "responseHeaders == null"
  560. invoke-direct {p1, p2}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
  561. throw p1
  562. .end method
  563. .method public declared-synchronized takeResponseHeaders()Ljava/util/List;
  564. .locals 2
  565. .annotation system Ldalvik/annotation/Signature;
  566. value = {
  567. "()",
  568. "Ljava/util/List<",
  569. "Lokhttp3/internal/http2/Header;",
  570. ">;"
  571. }
  572. .end annotation
  573. .annotation system Ldalvik/annotation/Throws;
  574. value = {
  575. Ljava/io/IOException;
  576. }
  577. .end annotation
  578. monitor-enter p0
  579. :try_start_0
  580. invoke-virtual {p0}, Lokhttp3/internal/http2/Http2Stream;->isLocallyInitiated()Z
  581. move-result v0
  582. if-eqz v0, :cond_2
  583. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->readTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  584. invoke-virtual {v0}, Lokio/AsyncTimeout;->enter()V
  585. :try_end_0
  586. .catchall {:try_start_0 .. :try_end_0} :catchall_1
  587. :goto_0
  588. :try_start_1
  589. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->responseHeaders:Ljava/util/List;
  590. if-nez v0, :cond_0
  591. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  592. if-nez v0, :cond_0
  593. invoke-virtual {p0}, Lokhttp3/internal/http2/Http2Stream;->waitForIo()V
  594. :try_end_1
  595. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  596. goto :goto_0
  597. :cond_0
  598. :try_start_2
  599. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->readTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  600. invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Stream$StreamTimeout;->exitAndThrowIfTimedOut()V
  601. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->responseHeaders:Ljava/util/List;
  602. if-eqz v0, :cond_1
  603. const/4 v1, 0x0
  604. iput-object v1, p0, Lokhttp3/internal/http2/Http2Stream;->responseHeaders:Ljava/util/List;
  605. :try_end_2
  606. .catchall {:try_start_2 .. :try_end_2} :catchall_1
  607. monitor-exit p0
  608. return-object v0
  609. :cond_1
  610. :try_start_3
  611. new-instance v0, Lokhttp3/internal/http2/StreamResetException;
  612. iget-object v1, p0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  613. invoke-direct {v0, v1}, Lokhttp3/internal/http2/StreamResetException;-><init>(Lokhttp3/internal/http2/ErrorCode;)V
  614. throw v0
  615. :catchall_0
  616. move-exception v0
  617. iget-object v1, p0, Lokhttp3/internal/http2/Http2Stream;->readTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  618. invoke-virtual {v1}, Lokhttp3/internal/http2/Http2Stream$StreamTimeout;->exitAndThrowIfTimedOut()V
  619. throw v0
  620. :cond_2
  621. new-instance v0, Ljava/lang/IllegalStateException;
  622. const-string v1, "servers cannot read response headers"
  623. invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  624. throw v0
  625. :try_end_3
  626. .catchall {:try_start_3 .. :try_end_3} :catchall_1
  627. :catchall_1
  628. move-exception v0
  629. monitor-exit p0
  630. goto :goto_2
  631. :goto_1
  632. throw v0
  633. :goto_2
  634. goto :goto_1
  635. .end method
  636. .method waitForIo()V
  637. .locals 1
  638. .annotation system Ldalvik/annotation/Throws;
  639. value = {
  640. Ljava/io/InterruptedIOException;
  641. }
  642. .end annotation
  643. :try_start_0
  644. invoke-virtual {p0}, Ljava/lang/Object;->wait()V
  645. :try_end_0
  646. .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0
  647. return-void
  648. :catch_0
  649. new-instance v0, Ljava/io/InterruptedIOException;
  650. invoke-direct {v0}, Ljava/io/InterruptedIOException;-><init>()V
  651. throw v0
  652. .end method
  653. .method public writeTimeout()Lokio/Timeout;
  654. .locals 1
  655. iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream;->writeTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
  656. return-object v0
  657. .end method