mayshukla/ece493-capstone

Clients aren't removed from matchmaking queue if they disconnect before a game starts

mayshukla opened this issue · 0 comments

If another client connects and a game is started, the follow error with be raised:

ServerToClientConnection closed
New ServerToClientConnection
Starting a new game
ERROR:tornado.application:Uncaught exception GET /websocket (::1)
HTTPServerRequest(protocol='http', host='localhost:9000', method='GET', uri='/websocket', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  File "/home/may/.local/lib/python3.10/site-packages/tornado/websocket.py", line 954, in _accept_connection
    open_result = handler.open(*handler.open_args, **handler.open_kwargs)
  File "/home/may/Files/school/ece493/ece493-capstone/src/server.py", line 24, in open
    self.game_server.enqueue(self)
  File "/home/may/Files/school/ece493/ece493-capstone/src/gameserver.py", line 19, in enqueue
    self.start_game(clients)
  File "/home/may/Files/school/ece493/ece493-capstone/src/gameserver.py", line 26, in start_game
    client.write_message("Found match. Starting game...")
  File "/home/may/.local/lib/python3.10/site-packages/tornado/websocket.py", line 337, in write_message
    raise WebSocketClosedError()
tornado.websocket.WebSocketClosedError