diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/APIv1.py | 2 | ||||
| -rw-r--r-- | src/socks.py | 14 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/APIv1.py b/src/APIv1.py index 7304e87..db8c4f3 100644 --- a/src/APIv1.py +++ b/src/APIv1.py @@ -59,7 +59,7 @@ def decode_size(size: str) -> int: return size -async def respond(client: SSLSocket, request: Request) -> tuple[int, bytes, dict]: +def respond(client: SSLSocket, request: Request) -> tuple[int, bytes, dict]: """ Respond to clients API request """ diff --git a/src/socks.py b/src/socks.py index bcb76c0..4e7d2ea 100644 --- a/src/socks.py +++ b/src/socks.py @@ -1,23 +1,19 @@ -import asyncio +from time import sleep from ssl import SSLSocket _SOCK_TIME_DELAY = 1.e-3 -async def ssl_sock_accept(sock: SSLSocket) -> tuple[SSLSocket, str]: +def ssl_sock_accept(sock: SSLSocket) -> tuple[SSLSocket, str]: while True: try: return sock.accept() except BlockingIOError: - await asyncio.sleep(_SOCK_TIME_DELAY) + sleep(_SOCK_TIME_DELAY) -async def ssl_sock_recv(sock: SSLSocket, buflen: int = 1024): +def ssl_sock_recv(sock: SSLSocket, buflen: int = 1024): while (msg := sock.recv(buflen)) == b'': - await asyncio.sleep(_SOCK_TIME_DELAY) + sleep(_SOCK_TIME_DELAY) return msg - - -async def ssl_sock_sendall(sock: SSLSocket, data: bytes): - sock.sendall(data) |