RealWebSocket$2.smali 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. .class Lokhttp3/internal/ws/RealWebSocket$2;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Lokhttp3/Callback;
  6. # annotations
  7. .annotation system Ldalvik/annotation/EnclosingMethod;
  8. value = Lokhttp3/internal/ws/RealWebSocket;->connect(Lokhttp3/OkHttpClient;)V
  9. .end annotation
  10. .annotation system Ldalvik/annotation/InnerClass;
  11. accessFlags = 0x0
  12. name = null
  13. .end annotation
  14. # instance fields
  15. .field final synthetic this$0:Lokhttp3/internal/ws/RealWebSocket;
  16. .field final synthetic val$pingIntervalMillis:I
  17. .field final synthetic val$request:Lokhttp3/Request;
  18. # direct methods
  19. .method constructor <init>(Lokhttp3/internal/ws/RealWebSocket;Lokhttp3/Request;I)V
  20. .locals 0
  21. iput-object p1, p0, Lokhttp3/internal/ws/RealWebSocket$2;->this$0:Lokhttp3/internal/ws/RealWebSocket;
  22. iput-object p2, p0, Lokhttp3/internal/ws/RealWebSocket$2;->val$request:Lokhttp3/Request;
  23. iput p3, p0, Lokhttp3/internal/ws/RealWebSocket$2;->val$pingIntervalMillis:I
  24. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  25. return-void
  26. .end method
  27. # virtual methods
  28. .method public onFailure(Lokhttp3/Call;Ljava/io/IOException;)V
  29. .locals 1
  30. iget-object p1, p0, Lokhttp3/internal/ws/RealWebSocket$2;->this$0:Lokhttp3/internal/ws/RealWebSocket;
  31. const/4 v0, 0x0
  32. invoke-virtual {p1, p2, v0}, Lokhttp3/internal/ws/RealWebSocket;->failWebSocket(Ljava/lang/Exception;Lokhttp3/Response;)V
  33. return-void
  34. .end method
  35. .method public onResponse(Lokhttp3/Call;Lokhttp3/Response;)V
  36. .locals 4
  37. :try_start_0
  38. iget-object v0, p0, Lokhttp3/internal/ws/RealWebSocket$2;->this$0:Lokhttp3/internal/ws/RealWebSocket;
  39. invoke-virtual {v0, p2}, Lokhttp3/internal/ws/RealWebSocket;->checkResponse(Lokhttp3/Response;)V
  40. :try_end_0
  41. .catch Ljava/net/ProtocolException; {:try_start_0 .. :try_end_0} :catch_1
  42. sget-object v0, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
  43. invoke-virtual {v0, p1}, Lokhttp3/internal/Internal;->streamAllocation(Lokhttp3/Call;)Lokhttp3/internal/connection/StreamAllocation;
  44. move-result-object p1
  45. invoke-virtual {p1}, Lokhttp3/internal/connection/StreamAllocation;->noNewStreams()V
  46. invoke-virtual {p1}, Lokhttp3/internal/connection/StreamAllocation;->connection()Lokhttp3/internal/connection/RealConnection;
  47. move-result-object v0
  48. invoke-virtual {v0, p1}, Lokhttp3/internal/connection/RealConnection;->newWebSocketStreams(Lokhttp3/internal/connection/StreamAllocation;)Lokhttp3/internal/ws/RealWebSocket$Streams;
  49. move-result-object v0
  50. :try_start_1
  51. iget-object v1, p0, Lokhttp3/internal/ws/RealWebSocket$2;->this$0:Lokhttp3/internal/ws/RealWebSocket;
  52. iget-object v1, v1, Lokhttp3/internal/ws/RealWebSocket;->listener:Lokhttp3/WebSocketListener;
  53. iget-object v2, p0, Lokhttp3/internal/ws/RealWebSocket$2;->this$0:Lokhttp3/internal/ws/RealWebSocket;
  54. invoke-virtual {v1, v2, p2}, Lokhttp3/WebSocketListener;->onOpen(Lokhttp3/WebSocket;Lokhttp3/Response;)V
  55. new-instance p2, Ljava/lang/StringBuilder;
  56. invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
  57. const-string v1, "OkHttp WebSocket "
  58. invoke-virtual {p2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  59. iget-object v1, p0, Lokhttp3/internal/ws/RealWebSocket$2;->val$request:Lokhttp3/Request;
  60. invoke-virtual {v1}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  61. move-result-object v1
  62. invoke-virtual {v1}, Lokhttp3/HttpUrl;->redact()Ljava/lang/String;
  63. move-result-object v1
  64. invoke-virtual {p2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  65. invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  66. move-result-object p2
  67. iget-object v1, p0, Lokhttp3/internal/ws/RealWebSocket$2;->this$0:Lokhttp3/internal/ws/RealWebSocket;
  68. iget v2, p0, Lokhttp3/internal/ws/RealWebSocket$2;->val$pingIntervalMillis:I
  69. int-to-long v2, v2
  70. invoke-virtual {v1, p2, v2, v3, v0}, Lokhttp3/internal/ws/RealWebSocket;->initReaderAndWriter(Ljava/lang/String;JLokhttp3/internal/ws/RealWebSocket$Streams;)V
  71. invoke-virtual {p1}, Lokhttp3/internal/connection/StreamAllocation;->connection()Lokhttp3/internal/connection/RealConnection;
  72. move-result-object p1
  73. invoke-virtual {p1}, Lokhttp3/internal/connection/RealConnection;->socket()Ljava/net/Socket;
  74. move-result-object p1
  75. const/4 p2, 0x0
  76. invoke-virtual {p1, p2}, Ljava/net/Socket;->setSoTimeout(I)V
  77. iget-object p1, p0, Lokhttp3/internal/ws/RealWebSocket$2;->this$0:Lokhttp3/internal/ws/RealWebSocket;
  78. invoke-virtual {p1}, Lokhttp3/internal/ws/RealWebSocket;->loopReader()V
  79. :try_end_1
  80. .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
  81. goto :goto_0
  82. :catch_0
  83. move-exception p1
  84. iget-object p2, p0, Lokhttp3/internal/ws/RealWebSocket$2;->this$0:Lokhttp3/internal/ws/RealWebSocket;
  85. const/4 v0, 0x0
  86. invoke-virtual {p2, p1, v0}, Lokhttp3/internal/ws/RealWebSocket;->failWebSocket(Ljava/lang/Exception;Lokhttp3/Response;)V
  87. :goto_0
  88. return-void
  89. :catch_1
  90. move-exception p1
  91. iget-object v0, p0, Lokhttp3/internal/ws/RealWebSocket$2;->this$0:Lokhttp3/internal/ws/RealWebSocket;
  92. invoke-virtual {v0, p1, p2}, Lokhttp3/internal/ws/RealWebSocket;->failWebSocket(Ljava/lang/Exception;Lokhttp3/Response;)V
  93. invoke-static {p2}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
  94. return-void
  95. .end method