[Pkg-mpd-commits] [python-mpd] 61/91: asyncio: move disconnect handling into __run where it can propagate to results

Simon McVittie smcv at debian.org
Sat Feb 24 14:55:37 UTC 2018


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository python-mpd.

commit 220d0d3ac7383663465d61111fe0a5dad8c0382e
Author: chrysn <chrysn at fsfe.org>
Date:   Fri Apr 21 11:12:31 2017 +0200

    asyncio: move disconnect handling into __run where it can propagate to results
---
 mpd/asyncio.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mpd/asyncio.py b/mpd/asyncio.py
index 173c523..b18b807 100644
--- a/mpd/asyncio.py
+++ b/mpd/asyncio.py
@@ -146,6 +146,12 @@ class MPDClient(MPDClientBase):
                 except CommandError as e:
                     result._feed_error(e)
                     break
+                except Exception as e:
+                    # see above
+                    result._feed_error(e)
+                    self.__run_task = None
+                    self.disconnect()
+                    return
                 result._feed_line(l)
                 if l is None:
                     break
@@ -178,7 +184,6 @@ class MPDClient(MPDClientBase):
         """Kind of like SyncMPDClient._read_line"""
         line = await self.__readline()
         if not line.endswith("\n"):
-            self.disconnect()
             raise ConnectionError("Connection lost while reading line")
         line = line.rstrip("\n")
         if line.startswith(ERROR_PREFIX):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git



More information about the Pkg-mpd-commits mailing list