Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoidable timeout on chat retrieval #13

Open
hippalectryon-0 opened this issue Jan 28, 2021 · 0 comments
Open

Avoidable timeout on chat retrieval #13

hippalectryon-0 opened this issue Jan 28, 2021 · 0 comments

Comments

@hippalectryon-0
Copy link

hippalectryon-0 commented Jan 28, 2021

image

In cogs/logs.py

inst.rcon.exec_command("a")
, cf lines in screenshot above:

If there has been no new messages since the last execution of _query (more precisely of inst.rcon.exec_command("a")), then self._sock.recv(HEADER_SIZE) in _recv_pkt (

def _recv_pkt(self, skip_empty_headers=True):
) will hang and cause a timeout.

While this is not critical, it is avoidable (timeouts last ~10s, making the whole execution hang). All that is needed is to check if the socket has new content before executing _recv_pkt (or earlier) via:

import select

r, _, _ = select.select([self._sock], [], [], 0)
if len(r) == 0: return  # the socket doesn't have new content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant