# import the config file. import Configs.conf as conf running = True lobby_host_id = -1 # the lobbies that exist on this host. lobbies = { } # key = lobby id in db, value is dict of lobby connections key socket, value connection lobbies_start_times = { } # key = lobby id value if > 0 start time else not enough players # set up terminate_signal = signal_handler.SignalHandler() Global.setup(conf) DEBUG.LOGS.init() DEBUG.LOGS.set_log_to_file(message=True, warning=True, error=True, fatal=True) database = db.Database() # register the host into the database # wait for the sql server to come online while not database.database.test_connection(): time.sleep(5) lobby_host_id = database.add_lobby_host(config.get("internal_host"))
# test server (to test passthroug connection) import socket import Common.database as database import Common.Globals as Global import Common.DEBUG as DEBUG import time print = DEBUG.LOGS.print # override python print with my own. config = Global.GlobalConfig Global.setup() host = config.get("internal_host") # socket.gethostname() # "DESKTOP-S8CVUEK" port = 8223 connected = False DEBUG.LOGS.init() DEBUG.LOGS.set_log_to_file(error=False) db = database.Database() # what for sql to come online while not db.database.test_connection(): time.sleep( 3 ) # try every 10 seconds time.sleep( 1.1 ) # we'll just wait a lil longer befor adding to the db db.database.insert_row("games", ["available", "host"], [True, host]) print (">-----", db.database.select_from_table( "games", ["host"] ) )