Skip to content

Commit 82e009e

Browse files
author
Simon J. Liu
committed
catch ConnectTimeoutException and send back an error message in makeRequestWithRetries
1 parent 4bb8195 commit 82e009e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/com/loopj/android/http/AsyncHttpRequest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.apache.http.HttpResponse;
2828
import org.apache.http.client.HttpRequestRetryHandler;
2929
import org.apache.http.client.methods.HttpUriRequest;
30+
import org.apache.http.conn.ConnectTimeoutException;
3031
import org.apache.http.impl.client.AbstractHttpClient;
3132
import org.apache.http.protocol.HttpContext;
3233

@@ -116,6 +117,11 @@ private void makeRequestWithRetries() throws ConnectException {
116117
responseHandler.sendFailureMessage(e, "socket time out");
117118
}
118119
return;
120+
} catch (ConnectTimeoutException e) {
121+
if (responseHandler != null) {
122+
responseHandler.sendFailureMessage(e, "connection time out");
123+
}
124+
return;
119125
} catch (IOException e) {
120126
cause = e;
121127
retry = retryHandler.retryRequest(cause, ++executionCount, context);

0 commit comments

Comments
 (0)