Browse Source

Compensate for timeout errors after first request

pull/20/head 2.4.4
Richard Neumann 2 years ago
parent
commit
7179042d86
  1. 11
      rcon/battleye/client.py

11
rcon/battleye/client.py

@ -67,12 +67,21 @@ class Client(BaseClient, socket_type=SOCK_DGRAM):
"""Send a request and receive a response."""
acknowledged = defaultdict(set)
command_responses = []
first = False
with self._socket.makefile("wb") as file:
file.write(bytes(request))
while True:
response = self.receive()
try:
response = self.receive()
except TimeoutError:
if first:
raise
else:
break
first = False
if isinstance(response, LoginResponse):
return response

Loading…
Cancel
Save