优化
This commit is contained in:
@@ -22,7 +22,6 @@ abstract class AbsCallBack(
|
|||||||
val mCall: Call,
|
val mCall: Call,
|
||||||
private val eventListener: EventListener? = null,
|
private val eventListener: EventListener? = null,
|
||||||
private val responseCallback: Callback? = null
|
private val responseCallback: Callback? = null
|
||||||
|
|
||||||
) : UrlRequest.Callback(), AutoCloseable {
|
) : UrlRequest.Callback(), AutoCloseable {
|
||||||
|
|
||||||
val buffer = Buffer()
|
val buffer = Buffer()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import java.nio.ByteBuffer
|
|||||||
|
|
||||||
@Keep
|
@Keep
|
||||||
class BodyUploadProvider(private val body: RequestBody) : UploadDataProvider(), AutoCloseable {
|
class BodyUploadProvider(private val body: RequestBody) : UploadDataProvider(), AutoCloseable {
|
||||||
|
|
||||||
private val buffer = Buffer()
|
private val buffer = Buffer()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import kotlin.coroutines.resumeWithException
|
|||||||
@Keep
|
@Keep
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
class CronetCoroutineInterceptor : Interceptor {
|
class CronetCoroutineInterceptor : Interceptor {
|
||||||
|
|
||||||
override fun intercept(chain: Interceptor.Chain): Response {
|
override fun intercept(chain: Interceptor.Chain): Response {
|
||||||
if (chain.call().isCanceled()) {
|
if (chain.call().isCanceled()) {
|
||||||
throw IOException("Canceled")
|
throw IOException("Canceled")
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.io.IOException
|
|||||||
@Keep
|
@Keep
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
class CronetInterceptor : Interceptor {
|
class CronetInterceptor : Interceptor {
|
||||||
|
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
override fun intercept(chain: Interceptor.Chain): Response {
|
override fun intercept(chain: Interceptor.Chain): Response {
|
||||||
if (chain.call().isCanceled()) {
|
if (chain.call().isCanceled()) {
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import java.util.concurrent.TimeUnit
|
|||||||
@Keep
|
@Keep
|
||||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||||
class NewCallBack(originalRequest: Request, mCall: Call) : AbsCallBack(originalRequest, mCall) {
|
class NewCallBack(originalRequest: Request, mCall: Call) : AbsCallBack(originalRequest, mCall) {
|
||||||
private val responseFuture = CompletableFuture<Response>()
|
|
||||||
|
|
||||||
|
private val responseFuture = CompletableFuture<Response>()
|
||||||
|
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
override fun waitForDone(urlRequest: UrlRequest): Response {
|
override fun waitForDone(urlRequest: UrlRequest): Response {
|
||||||
|
|||||||
Reference in New Issue
Block a user