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() {
930 const [hasIPv6, hasIPv4] = await getHasIP();930 const [hasIPv6, hasIPv4] = await getHasIP();
931 if (enableIPv6 === 'auto') {931 if (enableIPv6 === 'auto') {
932 useIPv6 = hasIPv6;932 useIPv6 = hasIPv6;
933 }
934 if (hasIPv6) {
933 if (useIPv6) {935 if (useIPv6) {
934 console.log(color.green('IPv6 support detected'));936 console.log(color.green('IPv6 support detected'));
937 } else {
938 console.log('IPv6 support detected');
935 }939 }
936 } else if (hasIPv6) {
937 console.log('IPv6 support detected');
938 }940 }
939941
942
940 if (enableIPv4 === 'auto') {943 if (enableIPv4 === 'auto') {
941 useIPv4 = hasIPv4;944 useIPv4 = hasIPv4;
942 if (useIPv4) {945 if (useIPv4) {
943 console.log(color.green('IPv4 support detected'));946 console.log(color.green('IPv4 support detected'));
944 }947 }
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 }
947 }955 }
948956
957
949 if (enableIPv6 === 'auto' && enableIPv4 === 'auto') {958 if (enableIPv6 === 'auto' && enableIPv4 === 'auto') {
950 if (!hasIPv6 && !hasIPv4) {959 if (!hasIPv6 && !hasIPv4) {
951 console.error('Both IPv6 and IPv4 are not detected');960 console.error('Both IPv6 and IPv4 are not detected');
952 process.exit(1)961 process.exit(1);
953 }962 }
954 }963 }
955964
956 if (!useIPv6 && !useIPv6) {965 if (!useIPv6 && !useIPv6) {
957 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');966 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');
958 process.exit(1)967 process.exit(1);
959 }968 }
960969
961 const [v6Failed, v4Failed] = await startHTTPorHTTPS(useIPv6, useIPv4);970 const [v6Failed, v4Failed] = await startHTTPorHTTPS(useIPv6, useIPv4);