Sometimes, an EOFError is raised on embedded devices or devices for which the SSH implementation cannot be fixed by the end user. Right now, I have a local patch that fixes this by catching the exception and closing the transport and socket but not bubbling the error up. It looks like this:
try:
self._start_session(transport)
except EOFError as e:
logging.error('Received EOFError. Assuming bad SSH implementation.')
logging.error('Stack trace: {}'.format(e))
self._session.close_session()
if transport:
transport.close()
self._socket.close()
except Exception as e:
logging.error(e)
self._session.close_session()
if transport:
transport.close()
self._socket.close()
raise e
Would you accept a pull request for this? It should probably ultimately be refactored to be less ugly and repeated less.
Hi.
Sometimes, an
EOFError
is raised on embedded devices or devices for which the SSH implementation cannot be fixed by the end user. Right now, I have a local patch that fixes this by catching the exception and closing the transport and socket but not bubbling the error up. It looks like this:Would you accept a pull request for this? It should probably ultimately be refactored to be less ugly and repeated less.
Thanks!