Transport: Fix NTCP removing IPv4 address when SSU removes IPv6 address

This commit is contained in:
zzz
2021-03-30 07:14:35 -04:00
parent f9422c9589
commit 8447086c59
2 changed files with 5 additions and 5 deletions

View File

@@ -323,21 +323,19 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
if (ip != null || port > 0)
_manager.externalAddressReceived(Transport.AddressSource.SOURCE_SSU, ip, port);
else
notifyRemoveAddress(false);
notifyRemoveAddress(udpAddr);
}
/**
* Tell other transports our address changed
*
* @param address non-null; but address's host/IP may be null
* @param address may be null; or address's host/IP may be null
* @since 0.9.20
*/
@Override
public void notifyRemoveAddress(RouterAddress address) {
// just keep this simple for now, multiple v4 or v6 addresses not yet supported
notifyRemoveAddress(address != null &&
address.getIP() != null &&
address.getIP().length == 16);
notifyRemoveAddress(address != null && TransportUtil.isIPv6(address));
}
/**

View File

@@ -124,6 +124,8 @@ public abstract class TransportUtil {
/**
* Addresses without a host (i.e. w/introducers)
* are assumed to be IPv4 unless a '6' cap is present
*
* @param addr non-null
*/
public static boolean isIPv6(RouterAddress addr) {
// do this the fast way, without calling getIP() to parse the host string