From 97189ca6b6b015006bee06305283ffd2d048c719 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 14 Mar 2020 18:53:16 +0100 Subject: [PATCH] Fallback to usable addresses only --- .../java/eu/faircode/email/EmailService.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index f6b856876b..7c3f2eb000 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -417,18 +417,20 @@ public class EmailService implements AutoCloseable { if (iaddr.equals(main)) continue; - if (!vpn) { - if (iaddr instanceof Inet4Address) { - if (ip4 || !has4) - continue; - ip4 = true; - } + if (iaddr instanceof Inet4Address) { + if (!has4) + continue; + if (!vpn && ip4) + continue; + ip4 = true; + } - if (iaddr instanceof Inet6Address) { - if (ip6 || !has6) - continue; - ip6 = true; - } + if (iaddr instanceof Inet6Address) { + if (!has6) + continue; + if (!vpn && ip6) + continue; + ip6 = true; } try {