conqp / rcon

Python RCON client library
GNU General Public License v3.0
83 stars 15 forks source link

Timeout with Rcon (async) instead of client #15

Closed SouDescolado closed 1 year ago

SouDescolado commented 1 year ago

I do have a bot where I need to use the rcon as async, however there is no timeout argument when running commands.

Is there any alternative for the Async version as there is for the Sync version?

conqp commented 1 year ago

Currently no. I have not worked on the async client for quite a while and am even thinking about dropping it altogether. The problem is, that Source RCON is not an asynchronous protocol, so the async client, though being an async function is not really running anything asynchronously, as you can see from all the chained await statements. If you want a timeout parameter implemented, I'd be happy to merge a respective pull request (Please comply with PEP-8).

SouDescolado commented 1 year ago

TBF I'm kinda bad on how coding work and everything I do that works is held together by duct tape and dreams. If I do manage to improve on this, I will do a PR. Thank you!

jgentil commented 1 year ago

The problem is, that Source RCON is not an asynchronous protocol, so the async client, though being an async function is not really running anything asynchronously, as you can see from all the chained await statements.

That's not what async means in Python. The protocol can be "synchronous" as in request and response, but the IO can still be async using async IO sockets. This way it can be used in an application (like Discord.py) that uses an async IO event loop without blocking IO in other parts of the application. HTTP is also a synchronous protocol with asynchronous client IO implementations.

Since I need this, I'll submit a PR that improves the async part of this and streamlines it.

conqp commented 1 year ago

I'd appreciate that. Tia.