adding delays
This commit is contained in:
@@ -2,10 +2,14 @@
|
||||
asyncio TCP server — connection handler with SO_ORIGINAL_DST support.
|
||||
"""
|
||||
import asyncio
|
||||
import random
|
||||
import socket
|
||||
import struct
|
||||
from typing import Optional
|
||||
|
||||
_DELAY_MIN = 0.2 # seconds
|
||||
_DELAY_MAX = 2.0 # seconds
|
||||
|
||||
from .config import Config
|
||||
from .logger import Logger
|
||||
|
||||
@@ -58,6 +62,7 @@ async def _handle(
|
||||
if banner:
|
||||
writer.write(banner)
|
||||
await writer.drain()
|
||||
await asyncio.sleep(random.uniform(_DELAY_MIN, _DELAY_MAX))
|
||||
except (ConnectionResetError, BrokenPipeError):
|
||||
pass
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user