From ba6165a4aa63b3b51ee9f34bcf9626e87ba38555 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Sat, 12 Nov 2005 01:38:27 +0000 Subject: [PATCH] [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-81] copy from jaramiko: only check for rekey at the beginning of a packet --- paramiko/packet.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paramiko/packet.py b/paramiko/packet.py index 19b59ce..e6c6ed3 100644 --- a/paramiko/packet.py +++ b/paramiko/packet.py @@ -167,7 +167,7 @@ class Packetizer (object): self.__keepalive_callback = callback self.__keepalive_last = time.time() - def read_all(self, n): + def read_all(self, n, check_rekey=False): """ Read as close to N bytes as possible, blocking as long as necessary. @@ -191,7 +191,7 @@ class Packetizer (object): except socket.timeout: if self.__closed: raise EOFError() - if self.__need_rekey: + if check_rekey and (len(out) == 0) and self.__need_rekey: raise NeedRekeyException() self._check_keepalive() return out @@ -278,7 +278,7 @@ class Packetizer (object): @raise SSHException: if the packet is mangled @raise NeedRekeyException: if the transport should rekey """ - header = self.read_all(self.__block_size_in) + header = self.read_all(self.__block_size_in, check_rekey=True) if self.__block_engine_in != None: header = self.__block_engine_in.decrypt(header) if self.__dump_packets: