diff options
author | Robey Pointer <robey@lag.net> | 2005-05-14 06:21:36 +0000 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2005-05-14 06:21:36 +0000 |
commit | cb5aa0671bfeafacd225de350db3f4e7a049e7bc (patch) | |
tree | 45deb2d66250b8e9329c075f5efff623572d1333 /paramiko/packet.py | |
parent | 366f216e3f4792da0f619e6aeff84a91230c2527 (diff) | |
download | paramiko-cb5aa0671bfeafacd225de350db3f4e7a049e7bc.tar.gz |
[project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-9]
oooh maybe i'll test things before checking them in next time: rekeying was a little bit overzealous. now it's careful to only rekey once and reset the counters in sync
Diffstat (limited to 'paramiko/packet.py')
-rw-r--r-- | paramiko/packet.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/paramiko/packet.py b/paramiko/packet.py index bf4cdb44..2fdc163d 100644 --- a/paramiko/packet.py +++ b/paramiko/packet.py @@ -46,6 +46,7 @@ class Packetizer (object): self.__closed = False self.__dump_packets = False self.__need_rekey = False + self.__init_count = 0 # used for noticing when to re-key: self.__sent_bytes = 0 @@ -100,7 +101,11 @@ class Packetizer (object): self.__mac_key_out = mac_key self.__sent_bytes = 0 self.__sent_packets = 0 - self.__need_rekey = False + # wait until the reset happens in both directions before clearing rekey flag + self.__init_count |= 1 + if self.__init_count == 3: + self.__init_count = 0 + self.__need_rekey = False def set_inbound_cipher(self, block_engine, block_size, mac_engine, mac_size, mac_key): """ @@ -114,7 +119,11 @@ class Packetizer (object): self.__received_bytes = 0 self.__received_packets = 0 self.__received_packets_overflow = 0 - self.__need_rekey = False + # wait until the reset happens in both directions before clearing rekey flag + self.__init_count |= 2 + if self.__init_count == 3: + self.__init_count = 0 + self.__need_rekey = False def close(self): self.__closed = True |