Skip to content

Commit 13eef78

Browse files
author
YangSen-qn
committed
modify dns cache logic
1 parent d64abc2 commit 13eef78

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

library/src/androidTest/java/com/qiniu/android/AsynTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void run() {
7070
@Override
7171
public void run() {
7272

73-
if (Thread.currentThread().getName().equals("main")){
73+
if (Thread.currentThread() == Looper.getMainLooper().getThread()){
7474
testParam.successCount += 1;
7575
}
7676

@@ -112,7 +112,7 @@ public void testAsyncBg(){
112112
@Override
113113
public void run() {
114114
String threadName = Thread.currentThread().getName();
115-
if (!threadName.equals("main")){
115+
if (Thread.currentThread() != Looper.getMainLooper().getThread()){
116116
synchronized (this){
117117
testParam.successCount += 1;
118118
}

library/src/main/java/com/qiniu/android/http/dns/DnsCacheFile.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public DnsCacheFile(String directory) throws IOException {
2929
throw new IOException("mkdir failed");
3030
}
3131
}
32+
33+
if (!f.isDirectory()) {
34+
throw new IOException("does not mkdir");
35+
}
3236
}
3337

3438
/**

0 commit comments

Comments
 (0)