Good working max performance settings. 500 concurrency easy. Silent.

This commit is contained in:
retoor 2024-12-18 04:15:57 +01:00
parent 5ec614bc35
commit 5e4db9dac3

View File

@ -76,7 +76,7 @@ class AsyncReader:
class Socket:
def __init__(self, reader, writer, buffer_size,debug=True):
def __init__(self, reader, writer, buffer_size,debug=False):
self.debug = debug
self.reader = AsyncReader(reader,debug=self.debug)
self.writer = AsyncWriter(writer,debug=self.debug)
@ -141,12 +141,10 @@ class Application:
if 'Content-Length' in headers:
while len(data) != headers['Content-Length']:
chunk_size = headers['Content-Length'] - len(data) if self.buffer_size > headers['Content-Length'] - len(data) else self.buffer_size
print("Bef read")
chunk = await reader.read(chunk_size)
if not chunk:
data = None
return None
print("Aff read")
data += chunk
await writer.write(self.header_dict_to_bytes(req_resp, headers))
await writer.drain()
@ -155,8 +153,6 @@ class Application:
else:
data = await reader.read()
await writer.write(data)
#if not headers.get('Connection') == 'keep-alive': # and not headers.get('Upgrade-Insecure-Requests'):
# break
if not is_websocket:
break
except asyncio.CancelledError: