正在显示
1 个修改的文件
包含
4 行增加
和
1 行删除
| @@ -202,6 +202,7 @@ constructor( | @@ -202,6 +202,7 @@ constructor( | ||
| 202 | isConnected = true | 202 | isConnected = true |
| 203 | joinContinuation?.resumeWith(Result.success(Either.Right(Unit))) | 203 | joinContinuation?.resumeWith(Result.success(Either.Right(Unit))) |
| 204 | } | 204 | } |
| 205 | + response.body?.close() | ||
| 205 | } | 206 | } |
| 206 | 207 | ||
| 207 | override fun onMessage(webSocket: WebSocket, text: String) { | 208 | override fun onMessage(webSocket: WebSocket, text: String) { |
| @@ -232,9 +233,11 @@ constructor( | @@ -232,9 +233,11 @@ constructor( | ||
| 232 | val validationUrl = "http" + it.substring(2).replaceFirst("/rtc?", "/rtc/validate?") | 233 | val validationUrl = "http" + it.substring(2).replaceFirst("/rtc?", "/rtc/validate?") |
| 233 | val request = Request.Builder().url(validationUrl).build() | 234 | val request = Request.Builder().url(validationUrl).build() |
| 234 | val resp = okHttpClient.newCall(request).execute() | 235 | val resp = okHttpClient.newCall(request).execute() |
| 236 | + val body = resp.body | ||
| 235 | if (!resp.isSuccessful) { | 237 | if (!resp.isSuccessful) { |
| 236 | - reason = resp.body?.string() | 238 | + reason = body?.string() |
| 237 | } | 239 | } |
| 240 | + body?.close() | ||
| 238 | } | 241 | } |
| 239 | } catch (e: Throwable) { | 242 | } catch (e: Throwable) { |
| 240 | LKLog.e(e) { "failed to validate connection" } | 243 | LKLog.e(e) { "failed to validate connection" } |
-
请 注册 或 登录 后发表评论