From 47a8014b4c0ea9b4c9750ed4f4b769c11ba2a6e7 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 6 Apr 2019 19:04:19 +0000 Subject: [PATCH] Fix disconnect() bug I just forgot to set the _state to _DISCONNECTING while disconnecting. --- yaboli/connection.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yaboli/connection.py b/yaboli/connection.py index f56df19..f781e48 100644 --- a/yaboli/connection.py +++ b/yaboli/connection.py @@ -258,7 +258,11 @@ class Connection: if self._state != self._RUNNING: 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._event_loop