fixed logic bug

9e049f44e296e531d67107f598a1ac34593b0412

BPplays <andymalbp@gmail.com>

1 files changed, +15 -6Ignore whitespace
server.js+15 -6
@@ -930,32 +930,41 @@ async function startServer() {
930930 const [hasIPv6, hasIPv4] = await getHasIP();
931931 if (enableIPv6 === 'auto') {
932932 useIPv6 = hasIPv6;
933+ }
934+ if (hasIPv6) {
933935 if (useIPv6) {
934936 console.log(color.green('IPv6 support detected'));
937+ } else {
938+ console.log('IPv6 support detected');
935939 }
936- } else if (hasIPv6) {
937- console.log('IPv6 support detected');
938940 }
939941
942+
940943 if (enableIPv4 === 'auto') {
941944 useIPv4 = hasIPv4;
942945 if (useIPv4) {
943946 console.log(color.green('IPv4 support detected'));
944947 }
945- } else if (hasIPv4) {
948+ }
946- console.log('IPv4 support detected');
949+ if (hasIPv4) {
950+ if (useIPv4) {
951+ console.log(color.green('IPv4 support detected'));
952+ } else {
953+ console.log('IPv4 support detected');
954+ }
947955 }
948956
957+
949958 if (enableIPv6 === 'auto' && enableIPv4 === 'auto') {
950959 if (!hasIPv6 && !hasIPv4) {
951960 console.error('Both IPv6 and IPv4 are not detected');
952961 process.exit(1);
953962 }
954963 }
955964
956965 if (!useIPv6 && !useIPv6) {
957966 console.error('Both IPv6 and IPv4 are disabled,\nP.S. you should never see this error, at least at one point it was checked for before this, with the rest of the config options');
958967 process.exit(1);
959968 }
960969
961970 const [v6Failed, v4Failed] = await startHTTPorHTTPS(useIPv6, useIPv4);