Http2Writer.smali 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418
  1. .class final Lokhttp3/internal/http2/Http2Writer;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Ljava/io/Closeable;
  6. # static fields
  7. .field private static final logger:Ljava/util/logging/Logger;
  8. # instance fields
  9. .field private final client:Z
  10. .field private closed:Z
  11. .field private final hpackBuffer:Lokio/Buffer;
  12. .field final hpackWriter:Lokhttp3/internal/http2/Hpack$Writer;
  13. .field private maxFrameSize:I
  14. .field private final sink:Lokio/BufferedSink;
  15. # direct methods
  16. .method static constructor <clinit>()V
  17. .locals 1
  18. const-class v0, Lokhttp3/internal/http2/Http2;
  19. invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String;
  20. move-result-object v0
  21. invoke-static {v0}, Ljava/util/logging/Logger;->getLogger(Ljava/lang/String;)Ljava/util/logging/Logger;
  22. move-result-object v0
  23. sput-object v0, Lokhttp3/internal/http2/Http2Writer;->logger:Ljava/util/logging/Logger;
  24. return-void
  25. .end method
  26. .method constructor <init>(Lokio/BufferedSink;Z)V
  27. .locals 0
  28. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  29. iput-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  30. iput-boolean p2, p0, Lokhttp3/internal/http2/Http2Writer;->client:Z
  31. new-instance p1, Lokio/Buffer;
  32. invoke-direct {p1}, Lokio/Buffer;-><init>()V
  33. iput-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->hpackBuffer:Lokio/Buffer;
  34. new-instance p1, Lokhttp3/internal/http2/Hpack$Writer;
  35. iget-object p2, p0, Lokhttp3/internal/http2/Http2Writer;->hpackBuffer:Lokio/Buffer;
  36. invoke-direct {p1, p2}, Lokhttp3/internal/http2/Hpack$Writer;-><init>(Lokio/Buffer;)V
  37. iput-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->hpackWriter:Lokhttp3/internal/http2/Hpack$Writer;
  38. const/16 p1, 0x4000
  39. iput p1, p0, Lokhttp3/internal/http2/Http2Writer;->maxFrameSize:I
  40. return-void
  41. .end method
  42. .method private writeContinuationFrames(IJ)V
  43. .locals 7
  44. .annotation system Ldalvik/annotation/Throws;
  45. value = {
  46. Ljava/io/IOException;
  47. }
  48. .end annotation
  49. :goto_0
  50. const-wide/16 v0, 0x0
  51. cmp-long v2, p2, v0
  52. if-lez v2, :cond_1
  53. iget v2, p0, Lokhttp3/internal/http2/Http2Writer;->maxFrameSize:I
  54. int-to-long v2, v2
  55. invoke-static {v2, v3, p2, p3}, Ljava/lang/Math;->min(JJ)J
  56. move-result-wide v2
  57. long-to-int v3, v2
  58. int-to-long v4, v3
  59. sub-long/2addr p2, v4
  60. const/16 v2, 0x9
  61. cmp-long v6, p2, v0
  62. if-nez v6, :cond_0
  63. const/4 v0, 0x4
  64. goto :goto_1
  65. :cond_0
  66. const/4 v0, 0x0
  67. :goto_1
  68. invoke-virtual {p0, p1, v3, v2, v0}, Lokhttp3/internal/http2/Http2Writer;->frameHeader(IIBB)V
  69. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  70. iget-object v1, p0, Lokhttp3/internal/http2/Http2Writer;->hpackBuffer:Lokio/Buffer;
  71. invoke-interface {v0, v1, v4, v5}, Lokio/Sink;->write(Lokio/Buffer;J)V
  72. goto :goto_0
  73. :cond_1
  74. return-void
  75. .end method
  76. .method private static writeMedium(Lokio/BufferedSink;I)V
  77. .locals 1
  78. .annotation system Ldalvik/annotation/Throws;
  79. value = {
  80. Ljava/io/IOException;
  81. }
  82. .end annotation
  83. ushr-int/lit8 v0, p1, 0x10
  84. and-int/lit16 v0, v0, 0xff
  85. invoke-interface {p0, v0}, Lokio/BufferedSink;->writeByte(I)Lokio/BufferedSink;
  86. ushr-int/lit8 v0, p1, 0x8
  87. and-int/lit16 v0, v0, 0xff
  88. invoke-interface {p0, v0}, Lokio/BufferedSink;->writeByte(I)Lokio/BufferedSink;
  89. and-int/lit16 p1, p1, 0xff
  90. invoke-interface {p0, p1}, Lokio/BufferedSink;->writeByte(I)Lokio/BufferedSink;
  91. return-void
  92. .end method
  93. # virtual methods
  94. .method public declared-synchronized applyAndAckSettings(Lokhttp3/internal/http2/Settings;)V
  95. .locals 2
  96. .annotation system Ldalvik/annotation/Throws;
  97. value = {
  98. Ljava/io/IOException;
  99. }
  100. .end annotation
  101. monitor-enter p0
  102. :try_start_0
  103. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  104. if-nez v0, :cond_1
  105. iget v0, p0, Lokhttp3/internal/http2/Http2Writer;->maxFrameSize:I
  106. invoke-virtual {p1, v0}, Lokhttp3/internal/http2/Settings;->getMaxFrameSize(I)I
  107. move-result v0
  108. iput v0, p0, Lokhttp3/internal/http2/Http2Writer;->maxFrameSize:I
  109. invoke-virtual {p1}, Lokhttp3/internal/http2/Settings;->getHeaderTableSize()I
  110. move-result v0
  111. const/4 v1, -0x1
  112. if-eq v0, v1, :cond_0
  113. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->hpackWriter:Lokhttp3/internal/http2/Hpack$Writer;
  114. invoke-virtual {p1}, Lokhttp3/internal/http2/Settings;->getHeaderTableSize()I
  115. move-result p1
  116. invoke-virtual {v0, p1}, Lokhttp3/internal/http2/Hpack$Writer;->setHeaderTableSizeSetting(I)V
  117. :cond_0
  118. const/4 p1, 0x4
  119. const/4 v0, 0x1
  120. const/4 v1, 0x0
  121. invoke-virtual {p0, v1, v1, p1, v0}, Lokhttp3/internal/http2/Http2Writer;->frameHeader(IIBB)V
  122. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  123. invoke-interface {p1}, Lokio/BufferedSink;->flush()V
  124. :try_end_0
  125. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  126. monitor-exit p0
  127. return-void
  128. :cond_1
  129. :try_start_1
  130. new-instance p1, Ljava/io/IOException;
  131. const-string v0, "closed"
  132. invoke-direct {p1, v0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  133. throw p1
  134. :try_end_1
  135. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  136. :catchall_0
  137. move-exception p1
  138. monitor-exit p0
  139. throw p1
  140. .end method
  141. .method public declared-synchronized close()V
  142. .locals 1
  143. .annotation system Ldalvik/annotation/Throws;
  144. value = {
  145. Ljava/io/IOException;
  146. }
  147. .end annotation
  148. monitor-enter p0
  149. const/4 v0, 0x1
  150. :try_start_0
  151. iput-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  152. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  153. invoke-interface {v0}, Lokio/Sink;->close()V
  154. :try_end_0
  155. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  156. monitor-exit p0
  157. return-void
  158. :catchall_0
  159. move-exception v0
  160. monitor-exit p0
  161. throw v0
  162. .end method
  163. .method public declared-synchronized connectionPreface()V
  164. .locals 5
  165. .annotation system Ldalvik/annotation/Throws;
  166. value = {
  167. Ljava/io/IOException;
  168. }
  169. .end annotation
  170. monitor-enter p0
  171. :try_start_0
  172. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  173. if-nez v0, :cond_2
  174. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->client:Z
  175. :try_end_0
  176. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  177. if-nez v0, :cond_0
  178. monitor-exit p0
  179. return-void
  180. :cond_0
  181. :try_start_1
  182. sget-object v0, Lokhttp3/internal/http2/Http2Writer;->logger:Ljava/util/logging/Logger;
  183. sget-object v1, Ljava/util/logging/Level;->FINE:Ljava/util/logging/Level;
  184. invoke-virtual {v0, v1}, Ljava/util/logging/Logger;->isLoggable(Ljava/util/logging/Level;)Z
  185. move-result v0
  186. if-eqz v0, :cond_1
  187. sget-object v0, Lokhttp3/internal/http2/Http2Writer;->logger:Ljava/util/logging/Logger;
  188. const-string v1, ">> CONNECTION %s"
  189. const/4 v2, 0x1
  190. new-array v2, v2, [Ljava/lang/Object;
  191. const/4 v3, 0x0
  192. sget-object v4, Lokhttp3/internal/http2/Http2;->CONNECTION_PREFACE:Lokio/ByteString;
  193. invoke-virtual {v4}, Lokio/ByteString;->hex()Ljava/lang/String;
  194. move-result-object v4
  195. aput-object v4, v2, v3
  196. invoke-static {v1, v2}, Lokhttp3/internal/Util;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
  197. move-result-object v1
  198. invoke-virtual {v0, v1}, Ljava/util/logging/Logger;->fine(Ljava/lang/String;)V
  199. :cond_1
  200. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  201. sget-object v1, Lokhttp3/internal/http2/Http2;->CONNECTION_PREFACE:Lokio/ByteString;
  202. invoke-virtual {v1}, Lokio/ByteString;->toByteArray()[B
  203. move-result-object v1
  204. invoke-interface {v0, v1}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;
  205. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  206. invoke-interface {v0}, Lokio/BufferedSink;->flush()V
  207. :try_end_1
  208. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  209. monitor-exit p0
  210. return-void
  211. :cond_2
  212. :try_start_2
  213. new-instance v0, Ljava/io/IOException;
  214. const-string v1, "closed"
  215. invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  216. throw v0
  217. :try_end_2
  218. .catchall {:try_start_2 .. :try_end_2} :catchall_0
  219. :catchall_0
  220. move-exception v0
  221. monitor-exit p0
  222. throw v0
  223. .end method
  224. .method public declared-synchronized data(ZILokio/Buffer;I)V
  225. .locals 1
  226. .annotation system Ldalvik/annotation/Throws;
  227. value = {
  228. Ljava/io/IOException;
  229. }
  230. .end annotation
  231. monitor-enter p0
  232. :try_start_0
  233. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  234. if-nez v0, :cond_1
  235. const/4 v0, 0x0
  236. if-eqz p1, :cond_0
  237. const/4 p1, 0x1
  238. int-to-byte v0, p1
  239. :cond_0
  240. invoke-virtual {p0, p2, v0, p3, p4}, Lokhttp3/internal/http2/Http2Writer;->dataFrame(IBLokio/Buffer;I)V
  241. :try_end_0
  242. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  243. monitor-exit p0
  244. return-void
  245. :cond_1
  246. :try_start_1
  247. new-instance p1, Ljava/io/IOException;
  248. const-string p2, "closed"
  249. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  250. throw p1
  251. :try_end_1
  252. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  253. :catchall_0
  254. move-exception p1
  255. monitor-exit p0
  256. throw p1
  257. .end method
  258. .method dataFrame(IBLokio/Buffer;I)V
  259. .locals 2
  260. .annotation system Ldalvik/annotation/Throws;
  261. value = {
  262. Ljava/io/IOException;
  263. }
  264. .end annotation
  265. const/4 v0, 0x0
  266. invoke-virtual {p0, p1, p4, v0, p2}, Lokhttp3/internal/http2/Http2Writer;->frameHeader(IIBB)V
  267. if-lez p4, :cond_0
  268. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  269. int-to-long v0, p4
  270. invoke-interface {p1, p3, v0, v1}, Lokio/Sink;->write(Lokio/Buffer;J)V
  271. :cond_0
  272. return-void
  273. .end method
  274. .method public declared-synchronized flush()V
  275. .locals 2
  276. .annotation system Ldalvik/annotation/Throws;
  277. value = {
  278. Ljava/io/IOException;
  279. }
  280. .end annotation
  281. monitor-enter p0
  282. :try_start_0
  283. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  284. if-nez v0, :cond_0
  285. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  286. invoke-interface {v0}, Lokio/BufferedSink;->flush()V
  287. :try_end_0
  288. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  289. monitor-exit p0
  290. return-void
  291. :cond_0
  292. :try_start_1
  293. new-instance v0, Ljava/io/IOException;
  294. const-string v1, "closed"
  295. invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  296. throw v0
  297. :try_end_1
  298. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  299. :catchall_0
  300. move-exception v0
  301. monitor-exit p0
  302. throw v0
  303. .end method
  304. .method public frameHeader(IIBB)V
  305. .locals 3
  306. .annotation system Ldalvik/annotation/Throws;
  307. value = {
  308. Ljava/io/IOException;
  309. }
  310. .end annotation
  311. sget-object v0, Lokhttp3/internal/http2/Http2Writer;->logger:Ljava/util/logging/Logger;
  312. sget-object v1, Ljava/util/logging/Level;->FINE:Ljava/util/logging/Level;
  313. invoke-virtual {v0, v1}, Ljava/util/logging/Logger;->isLoggable(Ljava/util/logging/Level;)Z
  314. move-result v0
  315. const/4 v1, 0x0
  316. if-eqz v0, :cond_0
  317. sget-object v0, Lokhttp3/internal/http2/Http2Writer;->logger:Ljava/util/logging/Logger;
  318. invoke-static {v1, p1, p2, p3, p4}, Lokhttp3/internal/http2/Http2;->frameLog(ZIIBB)Ljava/lang/String;
  319. move-result-object v2
  320. invoke-virtual {v0, v2}, Ljava/util/logging/Logger;->fine(Ljava/lang/String;)V
  321. :cond_0
  322. iget v0, p0, Lokhttp3/internal/http2/Http2Writer;->maxFrameSize:I
  323. const/4 v2, 0x1
  324. if-gt p2, v0, :cond_2
  325. const/high16 v0, -0x80000000
  326. and-int/2addr v0, p1
  327. if-nez v0, :cond_1
  328. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  329. invoke-static {v0, p2}, Lokhttp3/internal/http2/Http2Writer;->writeMedium(Lokio/BufferedSink;I)V
  330. iget-object p2, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  331. and-int/lit16 p3, p3, 0xff
  332. invoke-interface {p2, p3}, Lokio/BufferedSink;->writeByte(I)Lokio/BufferedSink;
  333. iget-object p2, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  334. and-int/lit16 p3, p4, 0xff
  335. invoke-interface {p2, p3}, Lokio/BufferedSink;->writeByte(I)Lokio/BufferedSink;
  336. iget-object p2, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  337. const p3, 0x7fffffff
  338. and-int/2addr p1, p3
  339. invoke-interface {p2, p1}, Lokio/BufferedSink;->writeInt(I)Lokio/BufferedSink;
  340. return-void
  341. :cond_1
  342. new-array p2, v2, [Ljava/lang/Object;
  343. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  344. move-result-object p1
  345. aput-object p1, p2, v1
  346. const-string p1, "reserved bit set: %s"
  347. invoke-static {p1, p2}, Lokhttp3/internal/http2/Http2;->illegalArgument(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/IllegalArgumentException;
  348. move-result-object p1
  349. throw p1
  350. :cond_2
  351. const/4 p1, 0x2
  352. new-array p1, p1, [Ljava/lang/Object;
  353. invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  354. move-result-object p3
  355. aput-object p3, p1, v1
  356. invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  357. move-result-object p2
  358. aput-object p2, p1, v2
  359. const-string p2, "FRAME_SIZE_ERROR length > %d: %d"
  360. invoke-static {p2, p1}, Lokhttp3/internal/http2/Http2;->illegalArgument(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/IllegalArgumentException;
  361. move-result-object p1
  362. throw p1
  363. .end method
  364. .method public declared-synchronized goAway(ILokhttp3/internal/http2/ErrorCode;[B)V
  365. .locals 3
  366. .annotation system Ldalvik/annotation/Throws;
  367. value = {
  368. Ljava/io/IOException;
  369. }
  370. .end annotation
  371. monitor-enter p0
  372. :try_start_0
  373. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  374. if-nez v0, :cond_2
  375. iget v0, p2, Lokhttp3/internal/http2/ErrorCode;->httpCode:I
  376. const/4 v1, -0x1
  377. const/4 v2, 0x0
  378. if-eq v0, v1, :cond_1
  379. array-length v0, p3
  380. add-int/lit8 v0, v0, 0x8
  381. const/4 v1, 0x7
  382. invoke-virtual {p0, v2, v0, v1, v2}, Lokhttp3/internal/http2/Http2Writer;->frameHeader(IIBB)V
  383. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  384. invoke-interface {v0, p1}, Lokio/BufferedSink;->writeInt(I)Lokio/BufferedSink;
  385. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  386. iget p2, p2, Lokhttp3/internal/http2/ErrorCode;->httpCode:I
  387. invoke-interface {p1, p2}, Lokio/BufferedSink;->writeInt(I)Lokio/BufferedSink;
  388. array-length p1, p3
  389. if-lez p1, :cond_0
  390. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  391. invoke-interface {p1, p3}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;
  392. :cond_0
  393. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  394. invoke-interface {p1}, Lokio/BufferedSink;->flush()V
  395. :try_end_0
  396. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  397. monitor-exit p0
  398. return-void
  399. :cond_1
  400. :try_start_1
  401. const-string p1, "errorCode.httpCode == -1"
  402. new-array p2, v2, [Ljava/lang/Object;
  403. invoke-static {p1, p2}, Lokhttp3/internal/http2/Http2;->illegalArgument(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/IllegalArgumentException;
  404. move-result-object p1
  405. throw p1
  406. :cond_2
  407. new-instance p1, Ljava/io/IOException;
  408. const-string p2, "closed"
  409. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  410. throw p1
  411. :try_end_1
  412. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  413. :catchall_0
  414. move-exception p1
  415. monitor-exit p0
  416. throw p1
  417. .end method
  418. .method public declared-synchronized headers(ILjava/util/List;)V
  419. .locals 1
  420. .annotation system Ldalvik/annotation/Signature;
  421. value = {
  422. "(I",
  423. "Ljava/util/List<",
  424. "Lokhttp3/internal/http2/Header;",
  425. ">;)V"
  426. }
  427. .end annotation
  428. .annotation system Ldalvik/annotation/Throws;
  429. value = {
  430. Ljava/io/IOException;
  431. }
  432. .end annotation
  433. monitor-enter p0
  434. :try_start_0
  435. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  436. if-nez v0, :cond_0
  437. const/4 v0, 0x0
  438. invoke-virtual {p0, v0, p1, p2}, Lokhttp3/internal/http2/Http2Writer;->headers(ZILjava/util/List;)V
  439. :try_end_0
  440. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  441. monitor-exit p0
  442. return-void
  443. :cond_0
  444. :try_start_1
  445. new-instance p1, Ljava/io/IOException;
  446. const-string p2, "closed"
  447. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  448. throw p1
  449. :try_end_1
  450. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  451. :catchall_0
  452. move-exception p1
  453. monitor-exit p0
  454. throw p1
  455. .end method
  456. .method headers(ZILjava/util/List;)V
  457. .locals 5
  458. .annotation system Ldalvik/annotation/Signature;
  459. value = {
  460. "(ZI",
  461. "Ljava/util/List<",
  462. "Lokhttp3/internal/http2/Header;",
  463. ">;)V"
  464. }
  465. .end annotation
  466. .annotation system Ldalvik/annotation/Throws;
  467. value = {
  468. Ljava/io/IOException;
  469. }
  470. .end annotation
  471. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  472. if-nez v0, :cond_3
  473. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->hpackWriter:Lokhttp3/internal/http2/Hpack$Writer;
  474. invoke-virtual {v0, p3}, Lokhttp3/internal/http2/Hpack$Writer;->writeHeaders(Ljava/util/List;)V
  475. iget-object p3, p0, Lokhttp3/internal/http2/Http2Writer;->hpackBuffer:Lokio/Buffer;
  476. invoke-virtual {p3}, Lokio/Buffer;->size()J
  477. move-result-wide v0
  478. iget p3, p0, Lokhttp3/internal/http2/Http2Writer;->maxFrameSize:I
  479. int-to-long v2, p3
  480. invoke-static {v2, v3, v0, v1}, Ljava/lang/Math;->min(JJ)J
  481. move-result-wide v2
  482. long-to-int p3, v2
  483. int-to-long v2, p3
  484. cmp-long v4, v0, v2
  485. if-nez v4, :cond_0
  486. const/4 v4, 0x4
  487. goto :goto_0
  488. :cond_0
  489. const/4 v4, 0x0
  490. :goto_0
  491. if-eqz p1, :cond_1
  492. or-int/lit8 p1, v4, 0x1
  493. int-to-byte v4, p1
  494. :cond_1
  495. const/4 p1, 0x1
  496. invoke-virtual {p0, p2, p3, p1, v4}, Lokhttp3/internal/http2/Http2Writer;->frameHeader(IIBB)V
  497. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  498. iget-object p3, p0, Lokhttp3/internal/http2/Http2Writer;->hpackBuffer:Lokio/Buffer;
  499. invoke-interface {p1, p3, v2, v3}, Lokio/Sink;->write(Lokio/Buffer;J)V
  500. cmp-long p1, v0, v2
  501. if-lez p1, :cond_2
  502. sub-long/2addr v0, v2
  503. invoke-direct {p0, p2, v0, v1}, Lokhttp3/internal/http2/Http2Writer;->writeContinuationFrames(IJ)V
  504. :cond_2
  505. return-void
  506. :cond_3
  507. new-instance p1, Ljava/io/IOException;
  508. const-string p2, "closed"
  509. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  510. throw p1
  511. .end method
  512. .method public maxDataLength()I
  513. .locals 1
  514. iget v0, p0, Lokhttp3/internal/http2/Http2Writer;->maxFrameSize:I
  515. return v0
  516. .end method
  517. .method public declared-synchronized ping(ZII)V
  518. .locals 3
  519. .annotation system Ldalvik/annotation/Throws;
  520. value = {
  521. Ljava/io/IOException;
  522. }
  523. .end annotation
  524. monitor-enter p0
  525. :try_start_0
  526. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  527. if-nez v0, :cond_1
  528. const/16 v0, 0x8
  529. const/4 v1, 0x6
  530. const/4 v2, 0x0
  531. if-eqz p1, :cond_0
  532. const/4 p1, 0x1
  533. goto :goto_0
  534. :cond_0
  535. const/4 p1, 0x0
  536. :goto_0
  537. invoke-virtual {p0, v2, v0, v1, p1}, Lokhttp3/internal/http2/Http2Writer;->frameHeader(IIBB)V
  538. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  539. invoke-interface {p1, p2}, Lokio/BufferedSink;->writeInt(I)Lokio/BufferedSink;
  540. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  541. invoke-interface {p1, p3}, Lokio/BufferedSink;->writeInt(I)Lokio/BufferedSink;
  542. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  543. invoke-interface {p1}, Lokio/BufferedSink;->flush()V
  544. :try_end_0
  545. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  546. monitor-exit p0
  547. return-void
  548. :cond_1
  549. :try_start_1
  550. new-instance p1, Ljava/io/IOException;
  551. const-string p2, "closed"
  552. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  553. throw p1
  554. :try_end_1
  555. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  556. :catchall_0
  557. move-exception p1
  558. monitor-exit p0
  559. throw p1
  560. .end method
  561. .method public declared-synchronized pushPromise(IILjava/util/List;)V
  562. .locals 7
  563. .annotation system Ldalvik/annotation/Signature;
  564. value = {
  565. "(II",
  566. "Ljava/util/List<",
  567. "Lokhttp3/internal/http2/Header;",
  568. ">;)V"
  569. }
  570. .end annotation
  571. .annotation system Ldalvik/annotation/Throws;
  572. value = {
  573. Ljava/io/IOException;
  574. }
  575. .end annotation
  576. monitor-enter p0
  577. :try_start_0
  578. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  579. if-nez v0, :cond_2
  580. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->hpackWriter:Lokhttp3/internal/http2/Hpack$Writer;
  581. invoke-virtual {v0, p3}, Lokhttp3/internal/http2/Hpack$Writer;->writeHeaders(Ljava/util/List;)V
  582. iget-object p3, p0, Lokhttp3/internal/http2/Http2Writer;->hpackBuffer:Lokio/Buffer;
  583. invoke-virtual {p3}, Lokio/Buffer;->size()J
  584. move-result-wide v0
  585. iget p3, p0, Lokhttp3/internal/http2/Http2Writer;->maxFrameSize:I
  586. const/4 v2, 0x4
  587. sub-int/2addr p3, v2
  588. int-to-long v3, p3
  589. invoke-static {v3, v4, v0, v1}, Ljava/lang/Math;->min(JJ)J
  590. move-result-wide v3
  591. long-to-int p3, v3
  592. const/4 v3, 0x5
  593. int-to-long v4, p3
  594. cmp-long v6, v0, v4
  595. if-nez v6, :cond_0
  596. const/4 v6, 0x4
  597. goto :goto_0
  598. :cond_0
  599. const/4 v6, 0x0
  600. :goto_0
  601. add-int/2addr p3, v2
  602. invoke-virtual {p0, p1, p3, v3, v6}, Lokhttp3/internal/http2/Http2Writer;->frameHeader(IIBB)V
  603. iget-object p3, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  604. const v2, 0x7fffffff
  605. and-int/2addr p2, v2
  606. invoke-interface {p3, p2}, Lokio/BufferedSink;->writeInt(I)Lokio/BufferedSink;
  607. iget-object p2, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  608. iget-object p3, p0, Lokhttp3/internal/http2/Http2Writer;->hpackBuffer:Lokio/Buffer;
  609. invoke-interface {p2, p3, v4, v5}, Lokio/Sink;->write(Lokio/Buffer;J)V
  610. cmp-long p2, v0, v4
  611. if-lez p2, :cond_1
  612. sub-long/2addr v0, v4
  613. invoke-direct {p0, p1, v0, v1}, Lokhttp3/internal/http2/Http2Writer;->writeContinuationFrames(IJ)V
  614. :try_end_0
  615. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  616. :cond_1
  617. monitor-exit p0
  618. return-void
  619. :cond_2
  620. :try_start_1
  621. new-instance p1, Ljava/io/IOException;
  622. const-string p2, "closed"
  623. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  624. throw p1
  625. :try_end_1
  626. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  627. :catchall_0
  628. move-exception p1
  629. monitor-exit p0
  630. throw p1
  631. .end method
  632. .method public declared-synchronized rstStream(ILokhttp3/internal/http2/ErrorCode;)V
  633. .locals 3
  634. .annotation system Ldalvik/annotation/Throws;
  635. value = {
  636. Ljava/io/IOException;
  637. }
  638. .end annotation
  639. monitor-enter p0
  640. :try_start_0
  641. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  642. if-nez v0, :cond_1
  643. iget v0, p2, Lokhttp3/internal/http2/ErrorCode;->httpCode:I
  644. const/4 v1, -0x1
  645. if-eq v0, v1, :cond_0
  646. const/4 v0, 0x4
  647. const/4 v1, 0x3
  648. const/4 v2, 0x0
  649. invoke-virtual {p0, p1, v0, v1, v2}, Lokhttp3/internal/http2/Http2Writer;->frameHeader(IIBB)V
  650. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  651. iget p2, p2, Lokhttp3/internal/http2/ErrorCode;->httpCode:I
  652. invoke-interface {p1, p2}, Lokio/BufferedSink;->writeInt(I)Lokio/BufferedSink;
  653. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  654. invoke-interface {p1}, Lokio/BufferedSink;->flush()V
  655. :try_end_0
  656. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  657. monitor-exit p0
  658. return-void
  659. :cond_0
  660. :try_start_1
  661. new-instance p1, Ljava/lang/IllegalArgumentException;
  662. invoke-direct {p1}, Ljava/lang/IllegalArgumentException;-><init>()V
  663. throw p1
  664. :cond_1
  665. new-instance p1, Ljava/io/IOException;
  666. const-string p2, "closed"
  667. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  668. throw p1
  669. :try_end_1
  670. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  671. :catchall_0
  672. move-exception p1
  673. monitor-exit p0
  674. throw p1
  675. .end method
  676. .method public declared-synchronized settings(Lokhttp3/internal/http2/Settings;)V
  677. .locals 4
  678. .annotation system Ldalvik/annotation/Throws;
  679. value = {
  680. Ljava/io/IOException;
  681. }
  682. .end annotation
  683. monitor-enter p0
  684. :try_start_0
  685. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  686. if-nez v0, :cond_4
  687. invoke-virtual {p1}, Lokhttp3/internal/http2/Settings;->size()I
  688. move-result v0
  689. mul-int/lit8 v0, v0, 0x6
  690. const/4 v1, 0x0
  691. const/4 v2, 0x4
  692. invoke-virtual {p0, v1, v0, v2, v1}, Lokhttp3/internal/http2/Http2Writer;->frameHeader(IIBB)V
  693. :goto_0
  694. const/16 v0, 0xa
  695. if-ge v1, v0, :cond_3
  696. invoke-virtual {p1, v1}, Lokhttp3/internal/http2/Settings;->isSet(I)Z
  697. move-result v0
  698. if-nez v0, :cond_0
  699. goto :goto_2
  700. :cond_0
  701. if-ne v1, v2, :cond_1
  702. const/4 v0, 0x3
  703. goto :goto_1
  704. :cond_1
  705. const/4 v0, 0x7
  706. if-ne v1, v0, :cond_2
  707. const/4 v0, 0x4
  708. goto :goto_1
  709. :cond_2
  710. move v0, v1
  711. :goto_1
  712. iget-object v3, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  713. invoke-interface {v3, v0}, Lokio/BufferedSink;->writeShort(I)Lokio/BufferedSink;
  714. iget-object v0, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  715. invoke-virtual {p1, v1}, Lokhttp3/internal/http2/Settings;->get(I)I
  716. move-result v3
  717. invoke-interface {v0, v3}, Lokio/BufferedSink;->writeInt(I)Lokio/BufferedSink;
  718. :goto_2
  719. add-int/lit8 v1, v1, 0x1
  720. goto :goto_0
  721. :cond_3
  722. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  723. invoke-interface {p1}, Lokio/BufferedSink;->flush()V
  724. :try_end_0
  725. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  726. monitor-exit p0
  727. return-void
  728. :cond_4
  729. :try_start_1
  730. new-instance p1, Ljava/io/IOException;
  731. const-string v0, "closed"
  732. invoke-direct {p1, v0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  733. throw p1
  734. :try_end_1
  735. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  736. :catchall_0
  737. move-exception p1
  738. monitor-exit p0
  739. goto :goto_4
  740. :goto_3
  741. throw p1
  742. :goto_4
  743. goto :goto_3
  744. .end method
  745. .method public declared-synchronized synReply(ZILjava/util/List;)V
  746. .locals 1
  747. .annotation system Ldalvik/annotation/Signature;
  748. value = {
  749. "(ZI",
  750. "Ljava/util/List<",
  751. "Lokhttp3/internal/http2/Header;",
  752. ">;)V"
  753. }
  754. .end annotation
  755. .annotation system Ldalvik/annotation/Throws;
  756. value = {
  757. Ljava/io/IOException;
  758. }
  759. .end annotation
  760. monitor-enter p0
  761. :try_start_0
  762. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  763. if-nez v0, :cond_0
  764. invoke-virtual {p0, p1, p2, p3}, Lokhttp3/internal/http2/Http2Writer;->headers(ZILjava/util/List;)V
  765. :try_end_0
  766. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  767. monitor-exit p0
  768. return-void
  769. :cond_0
  770. :try_start_1
  771. new-instance p1, Ljava/io/IOException;
  772. const-string p2, "closed"
  773. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  774. throw p1
  775. :try_end_1
  776. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  777. :catchall_0
  778. move-exception p1
  779. monitor-exit p0
  780. throw p1
  781. .end method
  782. .method public declared-synchronized synStream(ZIILjava/util/List;)V
  783. .locals 0
  784. .annotation system Ldalvik/annotation/Signature;
  785. value = {
  786. "(ZII",
  787. "Ljava/util/List<",
  788. "Lokhttp3/internal/http2/Header;",
  789. ">;)V"
  790. }
  791. .end annotation
  792. .annotation system Ldalvik/annotation/Throws;
  793. value = {
  794. Ljava/io/IOException;
  795. }
  796. .end annotation
  797. monitor-enter p0
  798. :try_start_0
  799. iget-boolean p3, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  800. if-nez p3, :cond_0
  801. invoke-virtual {p0, p1, p2, p4}, Lokhttp3/internal/http2/Http2Writer;->headers(ZILjava/util/List;)V
  802. :try_end_0
  803. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  804. monitor-exit p0
  805. return-void
  806. :cond_0
  807. :try_start_1
  808. new-instance p1, Ljava/io/IOException;
  809. const-string p2, "closed"
  810. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  811. throw p1
  812. :try_end_1
  813. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  814. :catchall_0
  815. move-exception p1
  816. monitor-exit p0
  817. throw p1
  818. .end method
  819. .method public declared-synchronized windowUpdate(IJ)V
  820. .locals 4
  821. .annotation system Ldalvik/annotation/Throws;
  822. value = {
  823. Ljava/io/IOException;
  824. }
  825. .end annotation
  826. monitor-enter p0
  827. :try_start_0
  828. iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Writer;->closed:Z
  829. if-nez v0, :cond_1
  830. const-wide/16 v0, 0x0
  831. const/4 v2, 0x0
  832. cmp-long v3, p2, v0
  833. if-eqz v3, :cond_0
  834. const-wide/32 v0, 0x7fffffff
  835. cmp-long v3, p2, v0
  836. if-gtz v3, :cond_0
  837. const/4 v0, 0x4
  838. const/16 v1, 0x8
  839. invoke-virtual {p0, p1, v0, v1, v2}, Lokhttp3/internal/http2/Http2Writer;->frameHeader(IIBB)V
  840. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  841. long-to-int p3, p2
  842. invoke-interface {p1, p3}, Lokio/BufferedSink;->writeInt(I)Lokio/BufferedSink;
  843. iget-object p1, p0, Lokhttp3/internal/http2/Http2Writer;->sink:Lokio/BufferedSink;
  844. invoke-interface {p1}, Lokio/BufferedSink;->flush()V
  845. :try_end_0
  846. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  847. monitor-exit p0
  848. return-void
  849. :cond_0
  850. :try_start_1
  851. const-string p1, "windowSizeIncrement == 0 || windowSizeIncrement > 0x7fffffffL: %s"
  852. const/4 v0, 0x1
  853. new-array v0, v0, [Ljava/lang/Object;
  854. invoke-static {p2, p3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
  855. move-result-object p2
  856. aput-object p2, v0, v2
  857. invoke-static {p1, v0}, Lokhttp3/internal/http2/Http2;->illegalArgument(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/IllegalArgumentException;
  858. move-result-object p1
  859. throw p1
  860. :cond_1
  861. new-instance p1, Ljava/io/IOException;
  862. const-string p2, "closed"
  863. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  864. throw p1
  865. :try_end_1
  866. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  867. :catchall_0
  868. move-exception p1
  869. monitor-exit p0
  870. throw p1
  871. .end method