File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
src/com/loopj/android/http Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -59,12 +59,18 @@ public void run() {
5959 }
6060 }
6161 }
62-
62+
6363 private void makeRequest () throws IOException {
64- HttpResponse response = client .execute (request , context );
65- if (responseHandler != null ) {
66- responseHandler .sendResponseMessage (response );
67- }
64+ if (!Thread .currentThread ().isInterrupted ()) {
65+ HttpResponse response = client .execute (request , context );
66+ if (!Thread .currentThread ().isInterrupted ()) {
67+ if (responseHandler != null ) {
68+ responseHandler .sendResponseMessage (response );
69+ }
70+ } else {
71+ //TODO: should raise InterruptedException? this block is reached whenever the request is cancelled before its response is received
72+ }
73+ }
6874 }
6975
7076 private void makeRequestWithRetries () throws ConnectException {
@@ -86,7 +92,7 @@ private void makeRequestWithRetries() throws ConnectException {
8692 // http://code.google.com/p/android/issues/detail?id=5255
8793 cause = new IOException ("NPE in HttpClient" + e .getMessage ());
8894 retry = retryHandler .retryRequest (cause , ++executionCount , context );
89- }
95+ }
9096 }
9197
9298 // no retries left, crap out with exception
You can’t perform that action at this time.
0 commit comments