Fix disconnect() bug

I just forgot to set the _state to _DISCONNECTING while disconnecting.
This commit is contained in:
Joscha 2019-04-06 19:04:19 +00:00
parent 0d9161fd1e
commit 47a8014b4c

View file

@ -258,7 +258,11 @@ class Connection:
if self._state != self._RUNNING: if self._state != self._RUNNING:
raise IncorrectStateException("This should never happen.") raise IncorrectStateException("This should never happen.")
# Now, we can properly disconnect ^^ # Now we're sure we're in the _RUNNING state, we can set our state.
# Important: No await-ing has occurred between checking the state and
# setting it.
self._state = self._DISCONNECTING
await self._disconnect() await self._disconnect()
await self._event_loop await self._event_loop