From 202767471f017c54d1ba73e2ad4bedca5ef0d40f Mon Sep 17 00:00:00 2001 From: "J. Alexander Treuman" Date: Sun, 23 Mar 2008 17:07:55 -0400 Subject: [PATCH 1/1] mpd.py: reset to disconnected state if _hello() fails in connect() --- mpd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mpd.py b/mpd.py index ae1f2b3..bd68b3c 100644 --- a/mpd.py +++ b/mpd.py @@ -307,7 +307,11 @@ class MPDClient(object): raise socket.error, msg self._rfile = self._sock.makefile("rb") self._wfile = self._sock.makefile("wb") - self._hello() + try: + self._hello() + except (socket.error, MPDError): + self.disconnect() + raise def disconnect(self): self._rfile.close() -- 2.39.2