File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
src/com/loopj/android/http Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 2020
2121import java .io .IOException ;
2222import java .net .ConnectException ;
23+ import java .net .SocketException ;
2324import java .net .UnknownHostException ;
2425
2526import org .apache .http .HttpResponse ;
@@ -92,11 +93,17 @@ private void makeRequestWithRetries() throws ConnectException {
9293 try {
9394 makeRequest ();
9495 return ;
95- } catch (UnknownHostException e ) {
96- if (responseHandler != null ) {
97- responseHandler .sendFailureMessage (e , "can't resolve host" );
98- }
99- return ;
96+ } catch (UnknownHostException e ) {
97+ if (responseHandler != null ) {
98+ responseHandler .sendFailureMessage (e , "can't resolve host" );
99+ }
100+ return ;
101+ }catch (SocketException e ){
102+ // Added to detect host unreachable
103+ if (responseHandler != null ) {
104+ responseHandler .sendFailureMessage (e , "can't resolve host" );
105+ }
106+ return ;
100107 } catch (IOException e ) {
101108 cause = e ;
102109 retry = retryHandler .retryRequest (cause , ++executionCount , context );
You can’t perform that action at this time.
0 commit comments