diff --git a/src/main/java/com/dispose/ability/impl/DpTechAbilityImpl.java b/src/main/java/com/dispose/ability/impl/DpTechAbilityImpl.java index b29f8310..4b1e168f 100644 --- a/src/main/java/com/dispose/ability/impl/DpTechAbilityImpl.java +++ b/src/main/java/com/dispose/ability/impl/DpTechAbilityImpl.java @@ -92,9 +92,6 @@ public class DpTechAbilityImpl implements DisposeAbility { //读取超时 policy.setReceiveTimeout(DpTechConfigValue.SOAP_RECEIVE_TIMEOUT_SECOND); conduit.setClient(policy); - - // 获取迪普设备防护IP - getDisposeDeviceProtectObject(); } /** @@ -266,16 +263,33 @@ public class DpTechAbilityImpl implements DisposeAbility { */ @Override public boolean isCarryProtectIp(String ipAddr) { + boolean ret = false; IPAddress addr = new IPAddressString(ipAddr).getAddress(); synchronized (this) { if (addr.isIPv4()) { - return protectIpV4.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr)); + ret = protectIpV4.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr)); } if (addr.isIPv6()) { - return protectIpV6.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr)); + ret = protectIpV6.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr)); } } - return false; + + if (!ret) { + // 更新迪普设备防护IP + getDisposeDeviceProtectObject(); + + synchronized (this) { + if (addr.isIPv4()) { + ret = protectIpV4.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr)); + } + + if (addr.isIPv6()) { + ret = protectIpV6.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr)); + } + } + } + + return ret; } }