Skip to content

Commit 66efa98

Browse files
committed
Documentation updated along with correct return values from RequestHandle.cancel(boolean), android-async-http#884
1 parent 9e1816f commit 66efa98

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

library/src/main/java/com/loopj/android/http/RequestHandle.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public RequestHandle(AsyncHttpRequest request) {
4040
* thread executing this request should be interrupted in an attempt to stop the request.
4141
* <p>&nbsp;</p> After this method returns, subsequent calls to isDone() will always return
4242
* true. Subsequent calls to isCancelled() will always return true if this method returned
43-
* true.
43+
* true. Subsequent calls to isDone() will return true either if the request got cancelled by
44+
* this method, or if the request completed normally
4445
*
4546
* @param mayInterruptIfRunning true if the thread executing this request should be interrupted;
4647
* otherwise, in-progress requests are allowed to complete
@@ -57,8 +58,11 @@ public void run() {
5758
_request.cancel(mayInterruptIfRunning);
5859
}
5960
}).start();
61+
// Cannot reliably tell if the request got immediately canceled at this point
62+
// we'll assume it got cancelled
63+
return true;
6064
} else {
61-
_request.cancel(mayInterruptIfRunning);
65+
return _request.cancel(mayInterruptIfRunning);
6266
}
6367
}
6468
return false;

0 commit comments

Comments
 (0)