Merge branch 'mcmanus-ping-port-patched' into dev

This commit is contained in:
computergeek125 2021-03-21 23:23:27 -05:00
commit 1d3880207f
4 changed files with 10 additions and 9 deletions

View File

@ -72,7 +72,7 @@ class Player:
# For the rest of requests see wiki.vg/Protocol
def ping(ip, port=25565):
def ping(ip, port):
def read_var_int():
i = 0
j = 0
@ -88,10 +88,11 @@ def ping(ip, port=25565):
if not (k & 0x80):
return i
sock = socket.socket()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
sock.connect((ip, port))
except:
except socket.error as err:
pass
return False

View File

@ -165,8 +165,8 @@ class Stats:
# TODO: search server properties file for possible override of 127.0.0.1
internal_ip = server_data.get('server_ip', "127.0.0.1")
server_port = server_settings.get('server_port', "25565")
internal_ip = server_data.get('server-ip', "127.0.0.1")
server_port = server_settings.get('server-port', "25565")
logger.debug("Pinging {} on port {}".format(internal_ip, server_port))
int_mc_ping = ping(internal_ip, int(server_port))
@ -196,6 +196,7 @@ class Stats:
# get our server object, settings and data dictionaries
server_obj = s.get('server_obj', None)
server_obj.reload_server_settings()
server_settings = s.get('server_settings', {})
server_data = s.get('server_data_obj', {})
@ -207,8 +208,8 @@ class Stats:
p_stats = self._get_process_stats(server_obj.PID)
# TODO: search server properties file for possible override of 127.0.0.1
internal_ip = server_data.get('server_ip', "127.0.0.1")
server_port = server_settings.get('server_port', "25565")
internal_ip = server_data.get('server-ip', "127.0.0.1")
server_port = server_settings.get('server-port', "25565")
logger.debug("Pinging {} on port {}".format(internal_ip, server_port))
int_mc_ping = ping(internal_ip, int(server_port))

View File

@ -211,7 +211,6 @@ class Server:
def check_running(self):
running = False
# if process is None, we never tried to start
if self.PID is None:
return running

View File

@ -32,7 +32,7 @@ def do_intro():
console.magenta(intro)
def setup_logging(debug=False):
def setup_logging(debug=True):
logging_config_file = os.path.join(os.path.curdir,
'app',
'config',