diff --git a/src/main/java/com/ejlchina/okhttps/internal/HttpClient.java b/src/main/java/com/ejlchina/okhttps/internal/HttpClient.java index 4f0998ddde0b544f83e38430e5091fa2b85d917b..e935d60406c894cd2e12d55f78a02440213b5e2f 100644 --- a/src/main/java/com/ejlchina/okhttps/internal/HttpClient.java +++ b/src/main/java/com/ejlchina/okhttps/internal/HttpClient.java @@ -82,6 +82,7 @@ public class HttpClient implements HTTP { @Override public void cancelAll() { client.dispatcher().cancelAll(); + tagTasks.clear(); } @Override @@ -159,9 +160,9 @@ public class HttpClient implements HTTP { public void preprocess(HttpTask> httpTask, Runnable request) { if (preprocessors.length > 0) { - RealPreChain process = new RealPreChain(preprocessors, + RealPreChain chain = new RealPreChain(preprocessors, httpTask, request); - preprocessors[0].doProcess(process); + preprocessors[0].doProcess(chain); } else { request.run(); } @@ -186,32 +187,32 @@ public class HttpClient implements HTTP { } @Override - public void doProcess(PreChain process) { + public void doProcess(PreChain chain) { boolean should = true; synchronized (this) { if (running) { - pendings.add(process); + pendings.add(chain); should = false; } else { running = true; } } if (should) { - preprocessor.doProcess(process); + preprocessor.doProcess(chain); } } public void afterProcess() { - PreChain process = null; + PreChain chain = null; synchronized (this) { if (pendings.size() > 0) { - process = pendings.poll(); + chain = pendings.poll(); } else { running = false; } } - if (process != null) { - preprocessor.doProcess(process); + if (chain != null) { + preprocessor.doProcess(chain); } }