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

[asyncio] Catch ConnectionErrors and force reconnect. #54

Open
johnlage opened this issue Oct 29, 2016 · 6 comments
Open

[asyncio] Catch ConnectionErrors and force reconnect. #54

johnlage opened this issue Oct 29, 2016 · 6 comments

Comments

@johnlage
Copy link

If a connection has a ConnectionError (for example ConnectionResetError), it does not get detected by pydle, and does not reconnect. It also seems that TimeoutErrors are not being caught either, once again causing pydle to not reconnect.

@johnlage
Copy link
Author

It seems that (at least on Mac) "No route to host" is raised as an OSError. TimeoutError extend OSError, so that shouldn't make too much of a difference. Anyway, a No route to host error is also not being caught by pydle, meaning no reconnect.

@shizmob
Copy link
Owner

shizmob commented Oct 30, 2016

Thanks for reporting. This seems easy enough to fix, I'll take a look at it.

@johnlage
Copy link
Author

I should probably note that if a TimeoutError occurs while in the main handle_forever() loop, that catching things in the connect() function will not help much.

@johnlage
Copy link
Author

johnlage commented Dec 4, 2016

It might be a good idea when building this to include some kind of callback in case of an error which also passed the exception/error object, for example, I am building a multi-network bot, and i want to be able to send a pm to the owner with specifics on the error, or a log channel, etc.

@yeryry
Copy link

yeryry commented Aug 17, 2017

Can this be fixed? Currently it's pretty useless, as disconnects aren't reliably handled and sometimes it just exits the loop rather than trying to reconnect.

@schoerg
Copy link

schoerg commented Feb 26, 2020

it can:

replace line 368 in client.py:

except (asyncio.TimeoutError, ConnectionResetError, ConnectionAbortedError):

and 375:

except (asyncio.TimeoutError, ConnectionResetError, ConnectionAbortedError) as e:

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

4 participants