From 31c26eafb90f245ea0d2baf60a5a573b362d901e Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Mon, 11 Sep 2006 10:56:04 -0700 Subject: [PATCH] [project @ robey@lag.net-20060911175604-bf2798fcebd62780] trap EOF errors when reading a response, and translate into SSHException --- paramiko/sftp_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index 6fa1cd9..9a1ecfd 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -598,7 +598,10 @@ class SFTPClient (BaseSFTP): def _read_response(self, waitfor=None): while True: - t, data = self._read_packet() + try: + t, data = self._read_packet() + except EOFError, e: + raise SSHException('Server connection dropped: %s' % (str(e),)) msg = Message(data) num = msg.get_int() if num not in self._expecting: