bluelet: catch ECONNRESET

When ncmpcpp quits after an error it causes a "connection reset by peer"
exception, also known as ECONNRESET (104) in errno terms. In Python
2 this is mapped to a `socket.error` and in Python 3 this is
  `ConnectionResetError` which is thankfully a subclass of the
  `socket.error` exception class.
This commit is contained in:
Carl Suster 2019-04-13 14:18:31 +10:00
parent 81b1faa053
commit 80286ea898

View file

@ -346,6 +346,10 @@ def run(root_coro):
exc.args[0] == errno.EPIPE:
# Broken pipe. Remote host disconnected.
pass
elif isinstance(exc.args, tuple) and \
exc.args[0] == errno.ECONNRESET:
# Connection was reset by peer.
pass
else:
traceback.print_exc()
# Abort the coroutine.