changeset 4258:6432c9bfd385

Fix bug with SSL-connection and XMLRPC... ...see my monologue at http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/9700 This also fixes a race condition where the forked roundup process would consume 99% CPU resources after the client opens the SSL connection but doesn't send anything, e.g., s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('localhost', 443)) ssl_sock = socket.ssl(s)
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Thu, 08 Oct 2009 12:18:47 +0000
parents a70dbbc7f967
children 074af2533618
files roundup/scripts/roundup_server.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/scripts/roundup_server.py	Fri Oct 02 15:03:44 2009 +0000
+++ b/roundup/scripts/roundup_server.py	Thu Oct 08 12:18:47 2009 +0000
@@ -29,6 +29,8 @@
 except ImportError:
     SSL = None
 
+from time import sleep
+
 # python version check
 from roundup import configuration, version_check
 from roundup import __version__ as roundup_version
@@ -127,9 +129,18 @@
                         try:
                             line = self.__fileobj.readline(*args)
                         except SSL.WantReadError:
+                            sleep (.1)
                             line = None
                     return line
 
+                def read(self, *args):
+                    """ SSL.Connection can return WantRead """
+                    while True:
+                        try:
+                            return self.__fileobj.read(*args)
+                        except SSL.WantReadError:
+                            sleep (.1)
+
                 def __getattr__(self, attrib):
                     return getattr(self.__fileobj, attrib)
 

Roundup Issue Tracker: http://roundup-tracker.org/