comparison roundup/scripts/roundup_server.py @ 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 c9cdc4eb8ca5
children 0a684518d609
comparison
equal deleted inserted replaced
4257:a70dbbc7f967 4258:6432c9bfd385
26 26
27 try: 27 try:
28 from OpenSSL import SSL 28 from OpenSSL import SSL
29 except ImportError: 29 except ImportError:
30 SSL = None 30 SSL = None
31
32 from time import sleep
31 33
32 # python version check 34 # python version check
33 from roundup import configuration, version_check 35 from roundup import configuration, version_check
34 from roundup import __version__ as roundup_version 36 from roundup import __version__ as roundup_version
35 37
125 line = None 127 line = None
126 while not line: 128 while not line:
127 try: 129 try:
128 line = self.__fileobj.readline(*args) 130 line = self.__fileobj.readline(*args)
129 except SSL.WantReadError: 131 except SSL.WantReadError:
132 sleep (.1)
130 line = None 133 line = None
131 return line 134 return line
135
136 def read(self, *args):
137 """ SSL.Connection can return WantRead """
138 while True:
139 try:
140 return self.__fileobj.read(*args)
141 except SSL.WantReadError:
142 sleep (.1)
132 143
133 def __getattr__(self, attrib): 144 def __getattr__(self, attrib):
134 return getattr(self.__fileobj, attrib) 145 return getattr(self.__fileobj, attrib)
135 146
136 class ConnFixer(object): 147 class ConnFixer(object):

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