Commit f6e0c9e9 authored by Stefan H. Holek's avatar Stefan H. Holek

Merged trunk r73189:73190 into 2.9 branch.

Protect against setNumberOfThreads disappearing after first use.
parent de614302
......@@ -22,6 +22,15 @@ from StringIO import StringIO
dummyLOG = StringIO()
def setNumberOfThreads(number_of_threads):
'''Sets number of ZServer threads.'''
try:
from ZServer.PubCore import setNumberOfThreads
setNumberOfThreads(number_of_threads)
except ImportError:
pass
def zserverRunner(host, port, log=None):
'''Runs an HTTP ZServer on host:port.'''
from ZServer import logger, asyncore
......
......@@ -115,7 +115,7 @@ def startZServer(number_of_threads=1, log=None):
if _Z2HOST is None:
_Z2HOST = '127.0.0.1'
_Z2PORT = random.choice(range(55000, 55500))
from ZServer import setNumberOfThreads
from threadutils import setNumberOfThreads
setNumberOfThreads(number_of_threads)
from threadutils import QuietThread, zserverRunner
t = QuietThread(target=zserverRunner, args=(_Z2HOST, _Z2PORT, log))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment