Browse Source

server debugging

Lurkars 6 years ago
parent
commit
f8c6cf74b6
  1. 6
      ext/server.py

6
ext/server.py

@ -46,11 +46,11 @@ def create_game():
if 'bots' in request.json:
bots = request.json.get('bots')
game_count = 0
try:
with sqlite3.connect("database.db") as con:
# check free port
port = START_PORT
game_count = 0
cur = con.cursor()
cur.execute("SELECT * FROM games WHERE port=?", (port,))
rows = cur.fetchall()
@ -61,7 +61,6 @@ def create_game():
rows = cur.fetchall()
if game_count >= MAX_GAMES:
abort(401)
return
print("debug: " + str(game_count))
@ -103,6 +102,9 @@ def create_game():
abort(500)
finally:
con.close()
if game_count >= MAX_GAMES:
abort(401)
return ""
return jsonify({'name': name, 'port': port})

Loading…
Cancel
Save