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 20
20
21
21
import java .io .IOException ;
22
22
import java .net .ConnectException ;
23
+ import java .net .SocketException ;
23
24
import java .net .UnknownHostException ;
24
25
25
26
import org .apache .http .HttpResponse ;
@@ -92,11 +93,17 @@ private void makeRequestWithRetries() throws ConnectException {
92
93
try {
93
94
makeRequest ();
94
95
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 ;
100
107
} catch (IOException e ) {
101
108
cause = e ;
102
109
retry = retryHandler .retryRequest (cause , ++executionCount , context );
You can’t perform that action at this time.
0 commit comments