Commit 228fff07 authored by Amos Latteier's avatar Amos Latteier

Changed HTTPServer, PCGIServer and FTPServer to override Medusa's listen queue...

Changed HTTPServer, PCGIServer and FTPServer to override Medusa's listen queue limit under NT. This should drastically improve ZServer's performace on NT under heavy loads and should prevent refused connections under most circumstances.
parent ba8705e7
......@@ -622,3 +622,7 @@ class FTPServer(ftp_server):
def readable(self):
return len(asyncore.socket_map) < CONNECTION_LIMIT
def listen(self, num):
# override asyncore limits for nt's listen queue size
self.accepting = 1
return self.socket.listen (num)
......@@ -185,7 +185,7 @@ class zhttp_handler:
size=get_header(CONTENT_LENGTH, request.header)
if size and size != '0':
size=string.atoi(size)
if size > 1048576:
if size > 524288:
# write large upload data to a file
from tempfile import TemporaryFile
self.data = TemporaryFile('w+b')
......@@ -352,3 +352,8 @@ class zhttp_server(http_server):
return self.accepting and \
len(asyncore.socket_map) < CONNECTION_LIMIT
def listen(self, num):
# override asyncore limits for nt's listen queue size
self.accepting = 1
return self.socket.listen (num)
......@@ -306,7 +306,7 @@ class PCGIServer(asyncore.dispatcher):
os.chmod(self.socket_file,0777)
except os.error:
pass
self.listen(5)
self.listen(256)
def read_info(self,info_file):
"read configuration information from a PCGI info file"
......@@ -345,7 +345,12 @@ class PCGIServer(asyncore.dispatcher):
def writable (self):
return 0
def listen(self, num):
# override asyncore limits for nt's listen queue size
self.accepting = 1
return self.socket.listen (num)
class PCGIResponse(HTTPResponse):
def _finish(self):
......
......@@ -622,3 +622,7 @@ class FTPServer(ftp_server):
def readable(self):
return len(asyncore.socket_map) < CONNECTION_LIMIT
def listen(self, num):
# override asyncore limits for nt's listen queue size
self.accepting = 1
return self.socket.listen (num)
......@@ -185,7 +185,7 @@ class zhttp_handler:
size=get_header(CONTENT_LENGTH, request.header)
if size and size != '0':
size=string.atoi(size)
if size > 1048576:
if size > 524288:
# write large upload data to a file
from tempfile import TemporaryFile
self.data = TemporaryFile('w+b')
......@@ -352,3 +352,8 @@ class zhttp_server(http_server):
return self.accepting and \
len(asyncore.socket_map) < CONNECTION_LIMIT
def listen(self, num):
# override asyncore limits for nt's listen queue size
self.accepting = 1
return self.socket.listen (num)
......@@ -306,7 +306,7 @@ class PCGIServer(asyncore.dispatcher):
os.chmod(self.socket_file,0777)
except os.error:
pass
self.listen(5)
self.listen(256)
def read_info(self,info_file):
"read configuration information from a PCGI info file"
......@@ -345,7 +345,12 @@ class PCGIServer(asyncore.dispatcher):
def writable (self):
return 0
def listen(self, num):
# override asyncore limits for nt's listen queue size
self.accepting = 1
return self.socket.listen (num)
class PCGIResponse(HTTPResponse):
def _finish(self):
......
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