fixed logic bug

9e049f44e296e531d67107f598a1ac34593b0412

BPplays <andymalbp@gmail.com>

1 files changed, +14 -5Showing whitespace changes
server.js+14 -5
@@ -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'));
935937 } else {
936- } else if (hasIPv6) {
937938 console.log('IPv6 support detected');
938939 }
940+ }
941+
939942
940943 if (enableIPv4 === 'auto') {
941944 useIPv4 = hasIPv4;
942945 if (useIPv4) {
943946 console.log(color.green('IPv4 support detected'));
944947 }
945- } else if (hasIPv4) {
948+ }
949+ if (hasIPv4) {
950+ if (useIPv4) {
951+ console.log(color.green('IPv4 support detected'));
952+ } else {
946953 console.log('IPv4 support detected');
947954 }
955+ }
956+
948957
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);