merge socket to master and fix httpdns cache has default
This commit is contained in:
@@ -118,7 +118,7 @@ internal class HttpDnsHelper(private val builder: MogoHttpDnsConfig) : Handler.C
|
||||
return defaultUrl ?: host
|
||||
}
|
||||
|
||||
override fun getHttpDnsCachedAddress(type: Int, _host: String): String? {
|
||||
override fun getHttpDnsCachedAddress(type: Int, _host: String): String {
|
||||
val host = _host.toLowerCase(Locale.getDefault())
|
||||
httpDnsCache?.let {
|
||||
val currentLoc = builder.getCurrentLocation()?.getCurrentLocation()
|
||||
@@ -140,7 +140,7 @@ internal class HttpDnsHelper(private val builder: MogoHttpDnsConfig) : Handler.C
|
||||
}
|
||||
}
|
||||
val default = defaultUrl ?: host
|
||||
return addressMap?.get("$type-$host")
|
||||
return addressMap?.get("$type-$host") ?: default
|
||||
}
|
||||
|
||||
override fun getAllAddress(): Map<String, String>? {
|
||||
|
||||
@@ -18,7 +18,7 @@ object MogoHttpDnsClient : IMogoHttpDns {
|
||||
* 先从本地缓存中根据type和host获取ip:port,如果本地缓存中没有,再通过网络获取
|
||||
*/
|
||||
fun getHttpDnsAddressUseCacheIfNecessary(type: Int, _host: String): String? {
|
||||
return getHttpDnsCachedAddress(type, _host) ?: return getHttpDnsAddress(type, _host)
|
||||
return getHttpDnsCachedAddress(type, _host)
|
||||
}
|
||||
|
||||
override fun addressChangedListener(addressChangedListener: OnAddressChangedListener) {
|
||||
|
||||
Reference in New Issue
Block a user