mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-15 13:35:04 -05:00
prefer ipv4 over ipv6
This commit is contained in:
parent
67bc032ccc
commit
c400f74918
@ -5,6 +5,7 @@ import android.support.annotation.NonNull;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.Inet4Address;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -157,6 +158,12 @@ public class Resolver {
|
|||||||
if (directTls == result.directTls) {
|
if (directTls == result.directTls) {
|
||||||
if (ip == null && result.ip == null) {
|
if (ip == null && result.ip == null) {
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (ip != null && result.ip != null) {
|
||||||
|
if (ip instanceof Inet4Address && result.ip instanceof Inet4Address) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return ip instanceof Inet4Address ? -1 : 1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return ip != null ? -1 : 1;
|
return ip != null ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user