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() {
59
59
}
60
60
}
61
61
}
62
-
62
+
63
63
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
+ }
68
74
}
69
75
70
76
private void makeRequestWithRetries () throws ConnectException {
@@ -86,7 +92,7 @@ private void makeRequestWithRetries() throws ConnectException {
86
92
// http://code.google.com/p/android/issues/detail?id=5255
87
93
cause = new IOException ("NPE in HttpClient" + e .getMessage ());
88
94
retry = retryHandler .retryRequest (cause , ++executionCount , context );
89
- }
95
+ }
90
96
}
91
97
92
98
// no retries left, crap out with exception
You can’t perform that action at this time.
0 commit comments