Skip to content

Commit 610f859

Browse files
committed
optimize dns lookup
1 parent 0776a59 commit 610f859

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

library/src/main/java/com/qiniu/android/http/HttpManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,14 @@ private void postEntity(String url, final HttpEntity entity, Header[] headers,
131131
@Override
132132
public void run() {
133133
final URI uri = URI.create(url2);
134-
String ip = Dns.getAddress(uri.getHost());
135-
if (ip == null || ip.equals("") || forceIp) {
134+
String ip = null;
135+
if (forceIp) {
136136
ip = backUpIp;
137+
}else {
138+
ip = Dns.getAddress(uri.getHost());
139+
if (ip == null || ip.equals("")){
140+
ip = backUpIp;
141+
}
137142
}
138143

139144
final Header[] h2 = new Header[h.length + 1];

0 commit comments

Comments
 (0)