mirror of https://github.com/Shizmob/pydle.git
Fix reconnection PEBCAK
- reset connection attributes BEFORE attempting a reconnect - otherwise certain fields (self.registered) have improper values
This commit is contained in:
parent
159e178549
commit
6821cf3fdb
|
@ -121,7 +121,6 @@ class BasicClient:
|
|||
if self._ping_checker_handle:
|
||||
self._ping_checker_handle.cancel()
|
||||
|
||||
|
||||
# Schedule disconnect.
|
||||
await self._disconnect(expected)
|
||||
|
||||
|
@ -129,6 +128,9 @@ class BasicClient:
|
|||
# Shutdown connection.
|
||||
await self.connection.disconnect()
|
||||
|
||||
# Reset any attributes.
|
||||
self._reset_attributes()
|
||||
|
||||
# Callback.
|
||||
await self.on_disconnect(expected)
|
||||
|
||||
|
@ -143,9 +145,6 @@ class BasicClient:
|
|||
if expected and self.own_eventloop:
|
||||
self.connection.stop()
|
||||
|
||||
# Reset any attributes.
|
||||
self._reset_attributes()
|
||||
|
||||
async def _connect(self, hostname, port, reconnect=False, channels=[],
|
||||
encoding=protocol.DEFAULT_ENCODING, source_address=None):
|
||||
""" Connect to IRC host. """
|
||||
|
|
|
@ -31,6 +31,7 @@ class CapabilityNegotiationSupport(rfc1459.RFC1459Support):
|
|||
async def _register(self):
|
||||
""" Hijack registration to send a CAP LS first. """
|
||||
if self.registered:
|
||||
self.logger.debug("skipping cap registration, already registered!")
|
||||
return
|
||||
|
||||
# Ask server to list capabilities.
|
||||
|
|
Loading…
Reference in New Issue