Catch UnsupportedAddressTypeException and fall back to IPv4 binding.

This commit is contained in:
CalDescent 2023-07-28 18:58:47 +01:00
parent 3215bb638d
commit 811b647c88

View File

@ -187,7 +187,7 @@ public class Network {
this.bindAddress = bindAddress; // Store the selected address, so that it can be used by other parts of the app this.bindAddress = bindAddress; // Store the selected address, so that it can be used by other parts of the app
break; // We don't want to bind to more than one address break; // We don't want to bind to more than one address
} catch (UnknownHostException e) { } catch (UnknownHostException | UnsupportedAddressTypeException e) {
LOGGER.error("Can't bind listen socket to address {}", Settings.getInstance().getBindAddress()); LOGGER.error("Can't bind listen socket to address {}", Settings.getInstance().getBindAddress());
if (i == bindAddresses.size()-1) { // Only throw an exception if all addresses have been tried if (i == bindAddresses.size()-1) { // Only throw an exception if all addresses have been tried
throw new IOException("Can't bind listen socket to address", e); throw new IOException("Can't bind listen socket to address", e);