mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'mcmanus-ping-port-patched' into dev
This commit is contained in:
commit
1d3880207f
@ -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
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user