From af407b47f0782ed8ce7e87abbc2c6cbf9bb56055 Mon Sep 17 00:00:00 2001 From: lxnay Date: Tue, 3 Jun 2008 21:33:30 +0000 Subject: [PATCH] Entropy/Socket Interface: - implement temporary loop check git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2103 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/entropy.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libraries/entropy.py b/libraries/entropy.py index 51262fb7d..42773c723 100644 --- a/libraries/entropy.py +++ b/libraries/entropy.py @@ -12436,8 +12436,23 @@ class SocketHostInterface: if self.valid_connection: + loop_counter = 0 + while 1: + # XXX: remove this, testing ! + loop_counter += 1 + if loop_conter > 100000000: + self.server.processor.HostInterface.updateProgress( + 'interrupted: %s, reason: %s - from client: %s' % ( + self.server.server_address, + "max while loop count reached", + self.client_address, + ) + ) + self.entropyTools.printTraceback() + break + if self.timed_out: break self.timed_out = True @@ -12474,7 +12489,7 @@ class SocketHostInterface: xlen = len(x) self.data_counter -= xlen self.buffered_data += x - if xlen == 0: + if not xlen: break self.data_counter = None except ValueError: