Good working max performance settings. 500 concurrency easy. Silent.
This commit is contained in:
parent
5ec614bc35
commit
5e4db9dac3
@ -76,7 +76,7 @@ class AsyncReader:
|
|||||||
|
|
||||||
class Socket:
|
class Socket:
|
||||||
|
|
||||||
def __init__(self, reader, writer, buffer_size,debug=True):
|
def __init__(self, reader, writer, buffer_size,debug=False):
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
self.reader = AsyncReader(reader,debug=self.debug)
|
self.reader = AsyncReader(reader,debug=self.debug)
|
||||||
self.writer = AsyncWriter(writer,debug=self.debug)
|
self.writer = AsyncWriter(writer,debug=self.debug)
|
||||||
@ -141,12 +141,10 @@ class Application:
|
|||||||
if 'Content-Length' in headers:
|
if 'Content-Length' in headers:
|
||||||
while len(data) != headers['Content-Length']:
|
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
|
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)
|
chunk = await reader.read(chunk_size)
|
||||||
if not chunk:
|
if not chunk:
|
||||||
data = None
|
data = None
|
||||||
return None
|
return None
|
||||||
print("Aff read")
|
|
||||||
data += chunk
|
data += chunk
|
||||||
await writer.write(self.header_dict_to_bytes(req_resp, headers))
|
await writer.write(self.header_dict_to_bytes(req_resp, headers))
|
||||||
await writer.drain()
|
await writer.drain()
|
||||||
@ -155,8 +153,6 @@ class Application:
|
|||||||
else:
|
else:
|
||||||
data = await reader.read()
|
data = await reader.read()
|
||||||
await writer.write(data)
|
await writer.write(data)
|
||||||
#if not headers.get('Connection') == 'keep-alive': # and not headers.get('Upgrade-Insecure-Requests'):
|
|
||||||
# break
|
|
||||||
if not is_websocket:
|
if not is_websocket:
|
||||||
break
|
break
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
|
Loading…
Reference in New Issue
Block a user