Reset reconnect delay on manual reconnect, add delay event
This is just a hotfix workaround for an underlying problem. The
_connect_routine code is "blocking" (in an async way) for
connect_loop_wait seconds, so that a fresh-started manual reconnect
will be silenty delayed. This code does the following changes:
It moves the delay to before the DNS resolution (with the exponential back-off it might well be that the DNS records are changed while slixmpp is waiting).
It adds a new event
reconnect_delaythat gets passed the number of seconds it will delay before actually reconnecting
It resets the
connect_loop_waittimer on a manual connect/reconnect call to fix the interactive experience.
A proper fix would replace the sleep in
_connect_routine with a
properly timered re-invocation of it, but I don't understand enough of
asyncio for pulling off that magic, and this is actually a proper
improvement. Also I tested this and it works!