StreamAllocation.smali 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420
  1. .class public final Lokhttp3/internal/connection/StreamAllocation;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/MemberClasses;
  6. value = {
  7. Lokhttp3/internal/connection/StreamAllocation$StreamAllocationReference;
  8. }
  9. .end annotation
  10. # static fields
  11. .field static final synthetic $assertionsDisabled:Z
  12. # instance fields
  13. .field public final address:Lokhttp3/Address;
  14. .field public final call:Lokhttp3/Call;
  15. .field private final callStackTrace:Ljava/lang/Object;
  16. .field private canceled:Z
  17. .field private codec:Lokhttp3/internal/http/HttpCodec;
  18. .field private connection:Lokhttp3/internal/connection/RealConnection;
  19. .field private final connectionPool:Lokhttp3/ConnectionPool;
  20. .field public final eventListener:Lokhttp3/EventListener;
  21. .field private refusedStreamCount:I
  22. .field private released:Z
  23. .field private reportedAcquired:Z
  24. .field private route:Lokhttp3/Route;
  25. .field private routeSelection:Lokhttp3/internal/connection/RouteSelector$Selection;
  26. .field private final routeSelector:Lokhttp3/internal/connection/RouteSelector;
  27. # direct methods
  28. .method static constructor <clinit>()V
  29. .locals 0
  30. return-void
  31. .end method
  32. .method public constructor <init>(Lokhttp3/ConnectionPool;Lokhttp3/Address;Lokhttp3/Call;Lokhttp3/EventListener;Ljava/lang/Object;)V
  33. .locals 1
  34. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  35. iput-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  36. iput-object p2, p0, Lokhttp3/internal/connection/StreamAllocation;->address:Lokhttp3/Address;
  37. iput-object p3, p0, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  38. iput-object p4, p0, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  39. new-instance p1, Lokhttp3/internal/connection/RouteSelector;
  40. invoke-direct {p0}, Lokhttp3/internal/connection/StreamAllocation;->routeDatabase()Lokhttp3/internal/connection/RouteDatabase;
  41. move-result-object v0
  42. invoke-direct {p1, p2, v0, p3, p4}, Lokhttp3/internal/connection/RouteSelector;-><init>(Lokhttp3/Address;Lokhttp3/internal/connection/RouteDatabase;Lokhttp3/Call;Lokhttp3/EventListener;)V
  43. iput-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->routeSelector:Lokhttp3/internal/connection/RouteSelector;
  44. iput-object p5, p0, Lokhttp3/internal/connection/StreamAllocation;->callStackTrace:Ljava/lang/Object;
  45. return-void
  46. .end method
  47. .method private deallocate(ZZZ)Ljava/net/Socket;
  48. .locals 1
  49. const/4 v0, 0x0
  50. if-eqz p3, :cond_0
  51. iput-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->codec:Lokhttp3/internal/http/HttpCodec;
  52. :cond_0
  53. const/4 p3, 0x1
  54. if-eqz p2, :cond_1
  55. iput-boolean p3, p0, Lokhttp3/internal/connection/StreamAllocation;->released:Z
  56. :cond_1
  57. iget-object p2, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  58. if-eqz p2, :cond_5
  59. if-eqz p1, :cond_2
  60. iput-boolean p3, p2, Lokhttp3/internal/connection/RealConnection;->noNewStreams:Z
  61. :cond_2
  62. iget-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->codec:Lokhttp3/internal/http/HttpCodec;
  63. if-nez p1, :cond_5
  64. iget-boolean p1, p0, Lokhttp3/internal/connection/StreamAllocation;->released:Z
  65. if-nez p1, :cond_3
  66. iget-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  67. iget-boolean p1, p1, Lokhttp3/internal/connection/RealConnection;->noNewStreams:Z
  68. if-eqz p1, :cond_5
  69. :cond_3
  70. iget-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  71. invoke-direct {p0, p1}, Lokhttp3/internal/connection/StreamAllocation;->release(Lokhttp3/internal/connection/RealConnection;)V
  72. iget-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  73. iget-object p1, p1, Lokhttp3/internal/connection/RealConnection;->allocations:Ljava/util/List;
  74. invoke-interface {p1}, Ljava/util/List;->isEmpty()Z
  75. move-result p1
  76. if-eqz p1, :cond_4
  77. iget-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  78. invoke-static {}, Ljava/lang/System;->nanoTime()J
  79. move-result-wide p2
  80. iput-wide p2, p1, Lokhttp3/internal/connection/RealConnection;->idleAtNanos:J
  81. sget-object p1, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
  82. iget-object p2, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  83. iget-object p3, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  84. invoke-virtual {p1, p2, p3}, Lokhttp3/internal/Internal;->connectionBecameIdle(Lokhttp3/ConnectionPool;Lokhttp3/internal/connection/RealConnection;)Z
  85. move-result p1
  86. if-eqz p1, :cond_4
  87. iget-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  88. invoke-virtual {p1}, Lokhttp3/internal/connection/RealConnection;->socket()Ljava/net/Socket;
  89. move-result-object p1
  90. goto :goto_0
  91. :cond_4
  92. move-object p1, v0
  93. :goto_0
  94. iput-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  95. goto :goto_1
  96. :cond_5
  97. move-object p1, v0
  98. :goto_1
  99. return-object p1
  100. .end method
  101. .method private findConnection(IIIZ)Lokhttp3/internal/connection/RealConnection;
  102. .locals 17
  103. .annotation system Ldalvik/annotation/Throws;
  104. value = {
  105. Ljava/io/IOException;
  106. }
  107. .end annotation
  108. move-object/from16 v1, p0
  109. iget-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  110. monitor-enter v2
  111. :try_start_0
  112. iget-boolean v0, v1, Lokhttp3/internal/connection/StreamAllocation;->released:Z
  113. if-nez v0, :cond_12
  114. iget-object v0, v1, Lokhttp3/internal/connection/StreamAllocation;->codec:Lokhttp3/internal/http/HttpCodec;
  115. if-nez v0, :cond_11
  116. iget-boolean v0, v1, Lokhttp3/internal/connection/StreamAllocation;->canceled:Z
  117. if-nez v0, :cond_10
  118. iget-object v0, v1, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  119. invoke-direct/range {p0 .. p0}, Lokhttp3/internal/connection/StreamAllocation;->releaseIfNoNewStreams()Ljava/net/Socket;
  120. move-result-object v3
  121. iget-object v4, v1, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  122. const/4 v5, 0x0
  123. if-eqz v4, :cond_0
  124. iget-object v0, v1, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  125. move-object v4, v5
  126. goto :goto_0
  127. :cond_0
  128. move-object v4, v0
  129. move-object v0, v5
  130. :goto_0
  131. iget-boolean v6, v1, Lokhttp3/internal/connection/StreamAllocation;->reportedAcquired:Z
  132. if-nez v6, :cond_1
  133. move-object v4, v5
  134. :cond_1
  135. const/4 v6, 0x1
  136. const/4 v7, 0x0
  137. if-nez v0, :cond_3
  138. sget-object v8, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
  139. iget-object v9, v1, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  140. iget-object v10, v1, Lokhttp3/internal/connection/StreamAllocation;->address:Lokhttp3/Address;
  141. invoke-virtual {v8, v9, v10, v1, v5}, Lokhttp3/internal/Internal;->get(Lokhttp3/ConnectionPool;Lokhttp3/Address;Lokhttp3/internal/connection/StreamAllocation;Lokhttp3/Route;)Lokhttp3/internal/connection/RealConnection;
  142. iget-object v8, v1, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  143. if-eqz v8, :cond_2
  144. iget-object v0, v1, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  145. move-object v8, v0
  146. move-object v9, v5
  147. const/4 v0, 0x1
  148. goto :goto_2
  149. :cond_2
  150. iget-object v8, v1, Lokhttp3/internal/connection/StreamAllocation;->route:Lokhttp3/Route;
  151. move-object v9, v8
  152. move-object v8, v0
  153. goto :goto_1
  154. :cond_3
  155. move-object v8, v0
  156. move-object v9, v5
  157. :goto_1
  158. const/4 v0, 0x0
  159. :goto_2
  160. monitor-exit v2
  161. :try_end_0
  162. .catchall {:try_start_0 .. :try_end_0} :catchall_2
  163. invoke-static {v3}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  164. if-eqz v4, :cond_4
  165. iget-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  166. iget-object v3, v1, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  167. invoke-virtual {v2, v3, v4}, Lokhttp3/EventListener;->connectionReleased(Lokhttp3/Call;Lokhttp3/Connection;)V
  168. :cond_4
  169. if-eqz v0, :cond_5
  170. iget-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  171. iget-object v3, v1, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  172. invoke-virtual {v2, v3, v8}, Lokhttp3/EventListener;->connectionAcquired(Lokhttp3/Call;Lokhttp3/Connection;)V
  173. :cond_5
  174. if-eqz v8, :cond_6
  175. return-object v8
  176. :cond_6
  177. if-nez v9, :cond_8
  178. iget-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->routeSelection:Lokhttp3/internal/connection/RouteSelector$Selection;
  179. if-eqz v2, :cond_7
  180. invoke-virtual {v2}, Lokhttp3/internal/connection/RouteSelector$Selection;->hasNext()Z
  181. move-result v2
  182. if-nez v2, :cond_8
  183. :cond_7
  184. iget-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->routeSelector:Lokhttp3/internal/connection/RouteSelector;
  185. invoke-virtual {v2}, Lokhttp3/internal/connection/RouteSelector;->next()Lokhttp3/internal/connection/RouteSelector$Selection;
  186. move-result-object v2
  187. iput-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->routeSelection:Lokhttp3/internal/connection/RouteSelector$Selection;
  188. const/4 v2, 0x1
  189. goto :goto_3
  190. :cond_8
  191. const/4 v2, 0x0
  192. :goto_3
  193. iget-object v3, v1, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  194. monitor-enter v3
  195. :try_start_1
  196. iget-boolean v4, v1, Lokhttp3/internal/connection/StreamAllocation;->canceled:Z
  197. if-nez v4, :cond_f
  198. if-eqz v2, :cond_a
  199. iget-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->routeSelection:Lokhttp3/internal/connection/RouteSelector$Selection;
  200. invoke-virtual {v2}, Lokhttp3/internal/connection/RouteSelector$Selection;->getAll()Ljava/util/List;
  201. move-result-object v2
  202. invoke-interface {v2}, Ljava/util/List;->size()I
  203. move-result v4
  204. const/4 v10, 0x0
  205. :goto_4
  206. if-ge v10, v4, :cond_a
  207. invoke-interface {v2, v10}, Ljava/util/List;->get(I)Ljava/lang/Object;
  208. move-result-object v11
  209. check-cast v11, Lokhttp3/Route;
  210. sget-object v12, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
  211. iget-object v13, v1, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  212. iget-object v14, v1, Lokhttp3/internal/connection/StreamAllocation;->address:Lokhttp3/Address;
  213. invoke-virtual {v12, v13, v14, v1, v11}, Lokhttp3/internal/Internal;->get(Lokhttp3/ConnectionPool;Lokhttp3/Address;Lokhttp3/internal/connection/StreamAllocation;Lokhttp3/Route;)Lokhttp3/internal/connection/RealConnection;
  214. iget-object v12, v1, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  215. if-eqz v12, :cond_9
  216. iget-object v8, v1, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  217. iput-object v11, v1, Lokhttp3/internal/connection/StreamAllocation;->route:Lokhttp3/Route;
  218. const/4 v0, 0x1
  219. goto :goto_5
  220. :cond_9
  221. add-int/lit8 v10, v10, 0x1
  222. goto :goto_4
  223. :cond_a
  224. :goto_5
  225. if-nez v0, :cond_c
  226. if-nez v9, :cond_b
  227. iget-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->routeSelection:Lokhttp3/internal/connection/RouteSelector$Selection;
  228. invoke-virtual {v2}, Lokhttp3/internal/connection/RouteSelector$Selection;->next()Lokhttp3/Route;
  229. move-result-object v9
  230. :cond_b
  231. iput-object v9, v1, Lokhttp3/internal/connection/StreamAllocation;->route:Lokhttp3/Route;
  232. iput v7, v1, Lokhttp3/internal/connection/StreamAllocation;->refusedStreamCount:I
  233. new-instance v8, Lokhttp3/internal/connection/RealConnection;
  234. iget-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  235. invoke-direct {v8, v2, v9}, Lokhttp3/internal/connection/RealConnection;-><init>(Lokhttp3/ConnectionPool;Lokhttp3/Route;)V
  236. invoke-virtual {v1, v8, v7}, Lokhttp3/internal/connection/StreamAllocation;->acquire(Lokhttp3/internal/connection/RealConnection;Z)V
  237. :cond_c
  238. monitor-exit v3
  239. :try_end_1
  240. .catchall {:try_start_1 .. :try_end_1} :catchall_1
  241. if-eqz v0, :cond_d
  242. :goto_6
  243. iget-object v0, v1, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  244. iget-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  245. invoke-virtual {v0, v2, v8}, Lokhttp3/EventListener;->connectionAcquired(Lokhttp3/Call;Lokhttp3/Connection;)V
  246. return-object v8
  247. :cond_d
  248. iget-object v15, v1, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  249. iget-object v0, v1, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  250. move-object v10, v8
  251. move/from16 v11, p1
  252. move/from16 v12, p2
  253. move/from16 v13, p3
  254. move/from16 v14, p4
  255. move-object/from16 v16, v0
  256. invoke-virtual/range {v10 .. v16}, Lokhttp3/internal/connection/RealConnection;->connect(IIIZLokhttp3/Call;Lokhttp3/EventListener;)V
  257. invoke-direct/range {p0 .. p0}, Lokhttp3/internal/connection/StreamAllocation;->routeDatabase()Lokhttp3/internal/connection/RouteDatabase;
  258. move-result-object v0
  259. invoke-virtual {v8}, Lokhttp3/internal/connection/RealConnection;->route()Lokhttp3/Route;
  260. move-result-object v2
  261. invoke-virtual {v0, v2}, Lokhttp3/internal/connection/RouteDatabase;->connected(Lokhttp3/Route;)V
  262. iget-object v2, v1, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  263. monitor-enter v2
  264. :try_start_2
  265. iput-boolean v6, v1, Lokhttp3/internal/connection/StreamAllocation;->reportedAcquired:Z
  266. sget-object v0, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
  267. iget-object v3, v1, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  268. invoke-virtual {v0, v3, v8}, Lokhttp3/internal/Internal;->put(Lokhttp3/ConnectionPool;Lokhttp3/internal/connection/RealConnection;)V
  269. invoke-virtual {v8}, Lokhttp3/internal/connection/RealConnection;->isMultiplexed()Z
  270. move-result v0
  271. if-eqz v0, :cond_e
  272. sget-object v0, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
  273. iget-object v3, v1, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  274. iget-object v4, v1, Lokhttp3/internal/connection/StreamAllocation;->address:Lokhttp3/Address;
  275. invoke-virtual {v0, v3, v4, v1}, Lokhttp3/internal/Internal;->deduplicate(Lokhttp3/ConnectionPool;Lokhttp3/Address;Lokhttp3/internal/connection/StreamAllocation;)Ljava/net/Socket;
  276. move-result-object v5
  277. iget-object v8, v1, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  278. :cond_e
  279. monitor-exit v2
  280. :try_end_2
  281. .catchall {:try_start_2 .. :try_end_2} :catchall_0
  282. invoke-static {v5}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  283. goto :goto_6
  284. :catchall_0
  285. move-exception v0
  286. :try_start_3
  287. monitor-exit v2
  288. :try_end_3
  289. .catchall {:try_start_3 .. :try_end_3} :catchall_0
  290. throw v0
  291. :cond_f
  292. :try_start_4
  293. new-instance v0, Ljava/io/IOException;
  294. const-string v2, "Canceled"
  295. invoke-direct {v0, v2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  296. throw v0
  297. :catchall_1
  298. move-exception v0
  299. monitor-exit v3
  300. :try_end_4
  301. .catchall {:try_start_4 .. :try_end_4} :catchall_1
  302. throw v0
  303. :cond_10
  304. :try_start_5
  305. new-instance v0, Ljava/io/IOException;
  306. const-string v3, "Canceled"
  307. invoke-direct {v0, v3}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  308. throw v0
  309. :cond_11
  310. new-instance v0, Ljava/lang/IllegalStateException;
  311. const-string v3, "codec != null"
  312. invoke-direct {v0, v3}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  313. throw v0
  314. :cond_12
  315. new-instance v0, Ljava/lang/IllegalStateException;
  316. const-string v3, "released"
  317. invoke-direct {v0, v3}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  318. throw v0
  319. :catchall_2
  320. move-exception v0
  321. monitor-exit v2
  322. :try_end_5
  323. .catchall {:try_start_5 .. :try_end_5} :catchall_2
  324. goto :goto_8
  325. :goto_7
  326. throw v0
  327. :goto_8
  328. goto :goto_7
  329. .end method
  330. .method private findHealthyConnection(IIIZZ)Lokhttp3/internal/connection/RealConnection;
  331. .locals 3
  332. .annotation system Ldalvik/annotation/Throws;
  333. value = {
  334. Ljava/io/IOException;
  335. }
  336. .end annotation
  337. :goto_0
  338. invoke-direct {p0, p1, p2, p3, p4}, Lokhttp3/internal/connection/StreamAllocation;->findConnection(IIIZ)Lokhttp3/internal/connection/RealConnection;
  339. move-result-object v0
  340. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  341. monitor-enter v1
  342. :try_start_0
  343. iget v2, v0, Lokhttp3/internal/connection/RealConnection;->successCount:I
  344. if-nez v2, :cond_0
  345. monitor-exit v1
  346. return-object v0
  347. :cond_0
  348. monitor-exit v1
  349. :try_end_0
  350. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  351. invoke-virtual {v0, p5}, Lokhttp3/internal/connection/RealConnection;->isHealthy(Z)Z
  352. move-result v1
  353. if-nez v1, :cond_1
  354. invoke-virtual {p0}, Lokhttp3/internal/connection/StreamAllocation;->noNewStreams()V
  355. goto :goto_0
  356. :cond_1
  357. return-object v0
  358. :catchall_0
  359. move-exception p1
  360. :try_start_1
  361. monitor-exit v1
  362. :try_end_1
  363. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  364. goto :goto_2
  365. :goto_1
  366. throw p1
  367. :goto_2
  368. goto :goto_1
  369. .end method
  370. .method private release(Lokhttp3/internal/connection/RealConnection;)V
  371. .locals 3
  372. iget-object v0, p1, Lokhttp3/internal/connection/RealConnection;->allocations:Ljava/util/List;
  373. invoke-interface {v0}, Ljava/util/List;->size()I
  374. move-result v0
  375. const/4 v1, 0x0
  376. :goto_0
  377. if-ge v1, v0, :cond_1
  378. iget-object v2, p1, Lokhttp3/internal/connection/RealConnection;->allocations:Ljava/util/List;
  379. invoke-interface {v2, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
  380. move-result-object v2
  381. check-cast v2, Ljava/lang/ref/Reference;
  382. invoke-virtual {v2}, Ljava/lang/ref/Reference;->get()Ljava/lang/Object;
  383. move-result-object v2
  384. if-ne v2, p0, :cond_0
  385. iget-object p1, p1, Lokhttp3/internal/connection/RealConnection;->allocations:Ljava/util/List;
  386. invoke-interface {p1, v1}, Ljava/util/List;->remove(I)Ljava/lang/Object;
  387. return-void
  388. :cond_0
  389. add-int/lit8 v1, v1, 0x1
  390. goto :goto_0
  391. :cond_1
  392. new-instance p1, Ljava/lang/IllegalStateException;
  393. invoke-direct {p1}, Ljava/lang/IllegalStateException;-><init>()V
  394. goto :goto_2
  395. :goto_1
  396. throw p1
  397. :goto_2
  398. goto :goto_1
  399. .end method
  400. .method private releaseIfNoNewStreams()Ljava/net/Socket;
  401. .locals 2
  402. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  403. if-eqz v0, :cond_0
  404. iget-boolean v0, v0, Lokhttp3/internal/connection/RealConnection;->noNewStreams:Z
  405. if-eqz v0, :cond_0
  406. const/4 v0, 0x1
  407. const/4 v1, 0x0
  408. invoke-direct {p0, v1, v1, v0}, Lokhttp3/internal/connection/StreamAllocation;->deallocate(ZZZ)Ljava/net/Socket;
  409. move-result-object v0
  410. return-object v0
  411. :cond_0
  412. const/4 v0, 0x0
  413. return-object v0
  414. .end method
  415. .method private routeDatabase()Lokhttp3/internal/connection/RouteDatabase;
  416. .locals 2
  417. sget-object v0, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
  418. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  419. invoke-virtual {v0, v1}, Lokhttp3/internal/Internal;->routeDatabase(Lokhttp3/ConnectionPool;)Lokhttp3/internal/connection/RouteDatabase;
  420. move-result-object v0
  421. return-object v0
  422. .end method
  423. # virtual methods
  424. .method public acquire(Lokhttp3/internal/connection/RealConnection;Z)V
  425. .locals 1
  426. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  427. if-nez v0, :cond_0
  428. iput-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  429. iput-boolean p2, p0, Lokhttp3/internal/connection/StreamAllocation;->reportedAcquired:Z
  430. iget-object p1, p1, Lokhttp3/internal/connection/RealConnection;->allocations:Ljava/util/List;
  431. new-instance p2, Lokhttp3/internal/connection/StreamAllocation$StreamAllocationReference;
  432. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->callStackTrace:Ljava/lang/Object;
  433. invoke-direct {p2, p0, v0}, Lokhttp3/internal/connection/StreamAllocation$StreamAllocationReference;-><init>(Lokhttp3/internal/connection/StreamAllocation;Ljava/lang/Object;)V
  434. invoke-interface {p1, p2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  435. return-void
  436. :cond_0
  437. new-instance p1, Ljava/lang/IllegalStateException;
  438. invoke-direct {p1}, Ljava/lang/IllegalStateException;-><init>()V
  439. throw p1
  440. .end method
  441. .method public cancel()V
  442. .locals 3
  443. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  444. monitor-enter v0
  445. const/4 v1, 0x1
  446. :try_start_0
  447. iput-boolean v1, p0, Lokhttp3/internal/connection/StreamAllocation;->canceled:Z
  448. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->codec:Lokhttp3/internal/http/HttpCodec;
  449. iget-object v2, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  450. monitor-exit v0
  451. :try_end_0
  452. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  453. if-eqz v1, :cond_0
  454. invoke-interface {v1}, Lokhttp3/internal/http/HttpCodec;->cancel()V
  455. goto :goto_0
  456. :cond_0
  457. if-eqz v2, :cond_1
  458. invoke-virtual {v2}, Lokhttp3/internal/connection/RealConnection;->cancel()V
  459. :cond_1
  460. :goto_0
  461. return-void
  462. :catchall_0
  463. move-exception v1
  464. :try_start_1
  465. monitor-exit v0
  466. :try_end_1
  467. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  468. throw v1
  469. .end method
  470. .method public codec()Lokhttp3/internal/http/HttpCodec;
  471. .locals 2
  472. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  473. monitor-enter v0
  474. :try_start_0
  475. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->codec:Lokhttp3/internal/http/HttpCodec;
  476. monitor-exit v0
  477. return-object v1
  478. :catchall_0
  479. move-exception v1
  480. monitor-exit v0
  481. :try_end_0
  482. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  483. throw v1
  484. .end method
  485. .method public declared-synchronized connection()Lokhttp3/internal/connection/RealConnection;
  486. .locals 1
  487. monitor-enter p0
  488. :try_start_0
  489. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  490. :try_end_0
  491. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  492. monitor-exit p0
  493. return-object v0
  494. :catchall_0
  495. move-exception v0
  496. monitor-exit p0
  497. throw v0
  498. .end method
  499. .method public hasMoreRoutes()Z
  500. .locals 1
  501. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->route:Lokhttp3/Route;
  502. if-nez v0, :cond_2
  503. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->routeSelection:Lokhttp3/internal/connection/RouteSelector$Selection;
  504. if-eqz v0, :cond_0
  505. invoke-virtual {v0}, Lokhttp3/internal/connection/RouteSelector$Selection;->hasNext()Z
  506. move-result v0
  507. if-nez v0, :cond_2
  508. :cond_0
  509. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->routeSelector:Lokhttp3/internal/connection/RouteSelector;
  510. invoke-virtual {v0}, Lokhttp3/internal/connection/RouteSelector;->hasNext()Z
  511. move-result v0
  512. if-eqz v0, :cond_1
  513. goto :goto_0
  514. :cond_1
  515. const/4 v0, 0x0
  516. goto :goto_1
  517. :cond_2
  518. :goto_0
  519. const/4 v0, 0x1
  520. :goto_1
  521. return v0
  522. .end method
  523. .method public newStream(Lokhttp3/OkHttpClient;Lokhttp3/Interceptor$Chain;Z)Lokhttp3/internal/http/HttpCodec;
  524. .locals 6
  525. invoke-interface {p2}, Lokhttp3/Interceptor$Chain;->connectTimeoutMillis()I
  526. move-result v1
  527. invoke-interface {p2}, Lokhttp3/Interceptor$Chain;->readTimeoutMillis()I
  528. move-result v2
  529. invoke-interface {p2}, Lokhttp3/Interceptor$Chain;->writeTimeoutMillis()I
  530. move-result v3
  531. invoke-virtual {p1}, Lokhttp3/OkHttpClient;->retryOnConnectionFailure()Z
  532. move-result v4
  533. move-object v0, p0
  534. move v5, p3
  535. :try_start_0
  536. invoke-direct/range {v0 .. v5}, Lokhttp3/internal/connection/StreamAllocation;->findHealthyConnection(IIIZZ)Lokhttp3/internal/connection/RealConnection;
  537. move-result-object p3
  538. invoke-virtual {p3, p1, p2, p0}, Lokhttp3/internal/connection/RealConnection;->newCodec(Lokhttp3/OkHttpClient;Lokhttp3/Interceptor$Chain;Lokhttp3/internal/connection/StreamAllocation;)Lokhttp3/internal/http/HttpCodec;
  539. move-result-object p1
  540. iget-object p2, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  541. monitor-enter p2
  542. :try_end_0
  543. .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
  544. :try_start_1
  545. iput-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->codec:Lokhttp3/internal/http/HttpCodec;
  546. monitor-exit p2
  547. return-object p1
  548. :catchall_0
  549. move-exception p1
  550. monitor-exit p2
  551. :try_end_1
  552. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  553. :try_start_2
  554. throw p1
  555. :try_end_2
  556. .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
  557. :catch_0
  558. move-exception p1
  559. new-instance p2, Lokhttp3/internal/connection/RouteException;
  560. invoke-direct {p2, p1}, Lokhttp3/internal/connection/RouteException;-><init>(Ljava/io/IOException;)V
  561. throw p2
  562. .end method
  563. .method public noNewStreams()V
  564. .locals 4
  565. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  566. monitor-enter v0
  567. :try_start_0
  568. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  569. const/4 v2, 0x1
  570. const/4 v3, 0x0
  571. invoke-direct {p0, v2, v3, v3}, Lokhttp3/internal/connection/StreamAllocation;->deallocate(ZZZ)Ljava/net/Socket;
  572. move-result-object v2
  573. iget-object v3, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  574. if-eqz v3, :cond_0
  575. const/4 v1, 0x0
  576. :cond_0
  577. monitor-exit v0
  578. :try_end_0
  579. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  580. invoke-static {v2}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  581. if-eqz v1, :cond_1
  582. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  583. iget-object v2, p0, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  584. invoke-virtual {v0, v2, v1}, Lokhttp3/EventListener;->connectionReleased(Lokhttp3/Call;Lokhttp3/Connection;)V
  585. :cond_1
  586. return-void
  587. :catchall_0
  588. move-exception v1
  589. :try_start_1
  590. monitor-exit v0
  591. :try_end_1
  592. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  593. throw v1
  594. .end method
  595. .method public release()V
  596. .locals 4
  597. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  598. monitor-enter v0
  599. :try_start_0
  600. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  601. const/4 v2, 0x1
  602. const/4 v3, 0x0
  603. invoke-direct {p0, v3, v2, v3}, Lokhttp3/internal/connection/StreamAllocation;->deallocate(ZZZ)Ljava/net/Socket;
  604. move-result-object v2
  605. iget-object v3, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  606. if-eqz v3, :cond_0
  607. const/4 v1, 0x0
  608. :cond_0
  609. monitor-exit v0
  610. :try_end_0
  611. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  612. invoke-static {v2}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  613. if-eqz v1, :cond_1
  614. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  615. iget-object v2, p0, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  616. invoke-virtual {v0, v2, v1}, Lokhttp3/EventListener;->connectionReleased(Lokhttp3/Call;Lokhttp3/Connection;)V
  617. :cond_1
  618. return-void
  619. :catchall_0
  620. move-exception v1
  621. :try_start_1
  622. monitor-exit v0
  623. :try_end_1
  624. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  625. throw v1
  626. .end method
  627. .method public releaseAndAcquire(Lokhttp3/internal/connection/RealConnection;)Ljava/net/Socket;
  628. .locals 3
  629. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->codec:Lokhttp3/internal/http/HttpCodec;
  630. if-nez v0, :cond_0
  631. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  632. iget-object v0, v0, Lokhttp3/internal/connection/RealConnection;->allocations:Ljava/util/List;
  633. invoke-interface {v0}, Ljava/util/List;->size()I
  634. move-result v0
  635. const/4 v1, 0x1
  636. if-ne v0, v1, :cond_0
  637. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  638. iget-object v0, v0, Lokhttp3/internal/connection/RealConnection;->allocations:Ljava/util/List;
  639. const/4 v2, 0x0
  640. invoke-interface {v0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
  641. move-result-object v0
  642. check-cast v0, Ljava/lang/ref/Reference;
  643. invoke-direct {p0, v1, v2, v2}, Lokhttp3/internal/connection/StreamAllocation;->deallocate(ZZZ)Ljava/net/Socket;
  644. move-result-object v1
  645. iput-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  646. iget-object p1, p1, Lokhttp3/internal/connection/RealConnection;->allocations:Ljava/util/List;
  647. invoke-interface {p1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  648. return-object v1
  649. :cond_0
  650. new-instance p1, Ljava/lang/IllegalStateException;
  651. invoke-direct {p1}, Ljava/lang/IllegalStateException;-><init>()V
  652. throw p1
  653. .end method
  654. .method public streamFailed(Ljava/io/IOException;)V
  655. .locals 6
  656. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  657. monitor-enter v0
  658. :try_start_0
  659. instance-of v1, p1, Lokhttp3/internal/http2/StreamResetException;
  660. const/4 v2, 0x0
  661. const/4 v3, 0x0
  662. const/4 v4, 0x1
  663. if-eqz v1, :cond_1
  664. check-cast p1, Lokhttp3/internal/http2/StreamResetException;
  665. iget-object v1, p1, Lokhttp3/internal/http2/StreamResetException;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  666. sget-object v5, Lokhttp3/internal/http2/ErrorCode;->REFUSED_STREAM:Lokhttp3/internal/http2/ErrorCode;
  667. if-ne v1, v5, :cond_0
  668. iget v1, p0, Lokhttp3/internal/connection/StreamAllocation;->refusedStreamCount:I
  669. add-int/2addr v1, v4
  670. iput v1, p0, Lokhttp3/internal/connection/StreamAllocation;->refusedStreamCount:I
  671. :cond_0
  672. iget-object p1, p1, Lokhttp3/internal/http2/StreamResetException;->errorCode:Lokhttp3/internal/http2/ErrorCode;
  673. sget-object v1, Lokhttp3/internal/http2/ErrorCode;->REFUSED_STREAM:Lokhttp3/internal/http2/ErrorCode;
  674. if-ne p1, v1, :cond_3
  675. iget p1, p0, Lokhttp3/internal/connection/StreamAllocation;->refusedStreamCount:I
  676. if-le p1, v4, :cond_5
  677. goto :goto_0
  678. :cond_1
  679. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  680. if-eqz v1, :cond_5
  681. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  682. invoke-virtual {v1}, Lokhttp3/internal/connection/RealConnection;->isMultiplexed()Z
  683. move-result v1
  684. if-eqz v1, :cond_2
  685. instance-of v1, p1, Lokhttp3/internal/http2/ConnectionShutdownException;
  686. if-eqz v1, :cond_5
  687. :cond_2
  688. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  689. iget v1, v1, Lokhttp3/internal/connection/RealConnection;->successCount:I
  690. if-nez v1, :cond_4
  691. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->route:Lokhttp3/Route;
  692. if-eqz v1, :cond_3
  693. if-eqz p1, :cond_3
  694. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->routeSelector:Lokhttp3/internal/connection/RouteSelector;
  695. iget-object v5, p0, Lokhttp3/internal/connection/StreamAllocation;->route:Lokhttp3/Route;
  696. invoke-virtual {v1, v5, p1}, Lokhttp3/internal/connection/RouteSelector;->connectFailed(Lokhttp3/Route;Ljava/io/IOException;)V
  697. :cond_3
  698. :goto_0
  699. iput-object v3, p0, Lokhttp3/internal/connection/StreamAllocation;->route:Lokhttp3/Route;
  700. :cond_4
  701. const/4 p1, 0x1
  702. goto :goto_1
  703. :cond_5
  704. const/4 p1, 0x0
  705. :goto_1
  706. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  707. invoke-direct {p0, p1, v2, v4}, Lokhttp3/internal/connection/StreamAllocation;->deallocate(ZZZ)Ljava/net/Socket;
  708. move-result-object p1
  709. iget-object v2, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  710. if-nez v2, :cond_6
  711. iget-boolean v2, p0, Lokhttp3/internal/connection/StreamAllocation;->reportedAcquired:Z
  712. if-nez v2, :cond_7
  713. :cond_6
  714. move-object v1, v3
  715. :cond_7
  716. monitor-exit v0
  717. :try_end_0
  718. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  719. invoke-static {p1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  720. if-eqz v1, :cond_8
  721. iget-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  722. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  723. invoke-virtual {p1, v0, v1}, Lokhttp3/EventListener;->connectionReleased(Lokhttp3/Call;Lokhttp3/Connection;)V
  724. :cond_8
  725. return-void
  726. :catchall_0
  727. move-exception p1
  728. :try_start_1
  729. monitor-exit v0
  730. :try_end_1
  731. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  732. throw p1
  733. .end method
  734. .method public streamFinished(ZLokhttp3/internal/http/HttpCodec;JLjava/io/IOException;)V
  735. .locals 2
  736. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  737. iget-object v1, p0, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  738. invoke-virtual {v0, v1, p3, p4}, Lokhttp3/EventListener;->responseBodyEnd(Lokhttp3/Call;J)V
  739. iget-object p3, p0, Lokhttp3/internal/connection/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
  740. monitor-enter p3
  741. if-eqz p2, :cond_5
  742. :try_start_0
  743. iget-object p4, p0, Lokhttp3/internal/connection/StreamAllocation;->codec:Lokhttp3/internal/http/HttpCodec;
  744. if-ne p2, p4, :cond_5
  745. const/4 p2, 0x1
  746. if-nez p1, :cond_0
  747. iget-object p4, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  748. iget v0, p4, Lokhttp3/internal/connection/RealConnection;->successCount:I
  749. add-int/2addr v0, p2
  750. iput v0, p4, Lokhttp3/internal/connection/RealConnection;->successCount:I
  751. :cond_0
  752. iget-object p4, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  753. const/4 v0, 0x0
  754. invoke-direct {p0, p1, v0, p2}, Lokhttp3/internal/connection/StreamAllocation;->deallocate(ZZZ)Ljava/net/Socket;
  755. move-result-object p1
  756. iget-object p2, p0, Lokhttp3/internal/connection/StreamAllocation;->connection:Lokhttp3/internal/connection/RealConnection;
  757. if-eqz p2, :cond_1
  758. const/4 p4, 0x0
  759. :cond_1
  760. iget-boolean p2, p0, Lokhttp3/internal/connection/StreamAllocation;->released:Z
  761. monitor-exit p3
  762. :try_end_0
  763. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  764. invoke-static {p1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  765. if-eqz p4, :cond_2
  766. iget-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  767. iget-object p3, p0, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  768. invoke-virtual {p1, p3, p4}, Lokhttp3/EventListener;->connectionReleased(Lokhttp3/Call;Lokhttp3/Connection;)V
  769. :cond_2
  770. if-eqz p5, :cond_3
  771. iget-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  772. iget-object p2, p0, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  773. invoke-virtual {p1, p2, p5}, Lokhttp3/EventListener;->callFailed(Lokhttp3/Call;Ljava/io/IOException;)V
  774. goto :goto_0
  775. :cond_3
  776. if-eqz p2, :cond_4
  777. iget-object p1, p0, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  778. iget-object p2, p0, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  779. invoke-virtual {p1, p2}, Lokhttp3/EventListener;->callEnd(Lokhttp3/Call;)V
  780. :cond_4
  781. :goto_0
  782. return-void
  783. :cond_5
  784. :try_start_1
  785. new-instance p1, Ljava/lang/IllegalStateException;
  786. new-instance p4, Ljava/lang/StringBuilder;
  787. invoke-direct {p4}, Ljava/lang/StringBuilder;-><init>()V
  788. const-string p5, "expected "
  789. invoke-virtual {p4, p5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  790. iget-object p5, p0, Lokhttp3/internal/connection/StreamAllocation;->codec:Lokhttp3/internal/http/HttpCodec;
  791. invoke-virtual {p4, p5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  792. const-string p5, " but was "
  793. invoke-virtual {p4, p5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  794. invoke-virtual {p4, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  795. invoke-virtual {p4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  796. move-result-object p2
  797. invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  798. throw p1
  799. :catchall_0
  800. move-exception p1
  801. monitor-exit p3
  802. :try_end_1
  803. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  804. throw p1
  805. .end method
  806. .method public toString()Ljava/lang/String;
  807. .locals 1
  808. invoke-virtual {p0}, Lokhttp3/internal/connection/StreamAllocation;->connection()Lokhttp3/internal/connection/RealConnection;
  809. move-result-object v0
  810. if-eqz v0, :cond_0
  811. invoke-virtual {v0}, Lokhttp3/internal/connection/RealConnection;->toString()Ljava/lang/String;
  812. move-result-object v0
  813. goto :goto_0
  814. :cond_0
  815. iget-object v0, p0, Lokhttp3/internal/connection/StreamAllocation;->address:Lokhttp3/Address;
  816. invoke-virtual {v0}, Lokhttp3/Address;->toString()Ljava/lang/String;
  817. move-result-object v0
  818. :goto_0
  819. return-object v0
  820. .end method