explicitly set a timeout for connecting and reading for a key server query
This commit is contained in:
@@ -87,6 +87,8 @@ public class HkpKeyServer extends KeyServer {
|
|||||||
String url = "http://" + ips[i].getHostAddress() + ":" + mPort + request;
|
String url = "http://" + ips[i].getHostAddress() + ":" + mPort + request;
|
||||||
URL realUrl = new URL(url);
|
URL realUrl = new URL(url);
|
||||||
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
|
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
|
||||||
|
conn.setConnectTimeout(5000);
|
||||||
|
conn.setReadTimeout(25000);
|
||||||
conn.connect();
|
conn.connect();
|
||||||
int response = conn.getResponseCode();
|
int response = conn.getResponseCode();
|
||||||
if (response >= 200 && response < 300) {
|
if (response >= 200 && response < 300) {
|
||||||
|
|||||||
Reference in New Issue
Block a user