kennedyshead / aioasuswrt

MIT License
24 stars 24 forks source link

Timeout errors and IncompleteRead exceptions on telnet connections #59

Closed JJdeVries closed 3 years ago

JJdeVries commented 3 years ago

Currently while running the asuswrt integration using Home Assistants a lot of Timeout errors and IncompleteRead exceptions are happening. A pull request has been opened on home-assistant/core that partially fixes this.

My feeling is that the underlying issue in the library is not nicely handling a persistent connection in one AsusWrt instance (at least for the TelnetConnection). Currently there is a race issue if two commands are happening (which probably causes the IncompleteRead exceptions). While the Timeouts are probably due to the router not being able to quickly handle consecutive logins.

My proposed solution would be to do simply try to write a command (assuming self._writer is not None), and capture the relevant exceptions if a logout has happened. I'm currently running a test with increasing delays to see what exceptions is actually raised.

kennedyshead commented 3 years ago

Great work!

I think this a much better approach