diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2013-09-15 13:16:26 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2013-09-15 13:16:26 +0200 |
commit | a716e4bbc0b79184de51883ec4b70e994436f9ab (patch) | |
tree | d4f6a3413f2f81f558c6e5ba89ef9feaace5463d /src | |
parent | 4d2275189e2860604406f3f3fa11e5f43dec8a4b (diff) | |
download | AntennaPod-a716e4bbc0b79184de51883ec4b70e994436f9ab.zip |
Added timeout to GpodnetService
Diffstat (limited to 'src')
-rw-r--r-- | src/de/danoeh/antennapod/gpoddernet/GpodnetService.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/de/danoeh/antennapod/gpoddernet/GpodnetService.java b/src/de/danoeh/antennapod/gpoddernet/GpodnetService.java index 7e0a34e0b..be95e5d1b 100644 --- a/src/de/danoeh/antennapod/gpoddernet/GpodnetService.java +++ b/src/de/danoeh/antennapod/gpoddernet/GpodnetService.java @@ -16,6 +16,8 @@ import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.entity.StringEntity; import org.apache.http.impl.auth.BasicScheme; import org.apache.http.params.CoreProtocolPNames; +import org.apache.http.params.HttpConnectionParams; +import org.apache.http.params.HttpParams; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -39,11 +41,16 @@ public class GpodnetService { private static final String BASE_SCHEME = "https"; private static final String BASE_HOST = "gpodder.net"; - private GpodnetClient httpClient; + private static final int TIMEOUT_MILLIS = 20000; + + private final GpodnetClient httpClient; public GpodnetService() { httpClient = new GpodnetClient(); - httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, AppConfig.USER_AGENT); + final HttpParams params = httpClient.getParams(); + params.setParameter(CoreProtocolPNames.USER_AGENT, AppConfig.USER_AGENT); + HttpConnectionParams.setConnectionTimeout(params, TIMEOUT_MILLIS); + HttpConnectionParams.setSoTimeout(params, TIMEOUT_MILLIS); } /** |