about summary refs log tree commit diff
path: root/src/socks.py
diff options
context:
space:
mode:
authorUltraQbik <no1skill@yandex.ru>2024-08-22 22:38:08 +0300
committerUltraQbik <no1skill@yandex.ru>2024-08-22 22:38:08 +0300
commit422e9c74b070ee82d225c0ef17193b295907e0b5 (patch)
tree6f021abfa64ed2fb9efe64427c8cda9f073c63ee /src/socks.py
parent832f86f4697f314d296264bfb7b8e485a560bf55 (diff)
downloadhttpy-422e9c74b070ee82d225c0ef17193b295907e0b5.tar.gz
httpy-422e9c74b070ee82d225c0ef17193b295907e0b5.zip
Update things slightly
Diffstat (limited to 'src/socks.py')
-rw-r--r--src/socks.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/socks.py b/src/socks.py
index 119a62a..bcb76c0 100644
--- a/src/socks.py
+++ b/src/socks.py
@@ -1,18 +1,21 @@
-import time
+import asyncio
 from ssl import SSLSocket
 
 
+_SOCK_TIME_DELAY = 1.e-3
+
+
 async def ssl_sock_accept(sock: SSLSocket) -> tuple[SSLSocket, str]:
     while True:
         try:
             return sock.accept()
         except BlockingIOError:
-            time.sleep(1.e-3)
+            await asyncio.sleep(_SOCK_TIME_DELAY)
 
 
 async def ssl_sock_recv(sock: SSLSocket, buflen: int = 1024):
     while (msg := sock.recv(buflen)) == b'':
-        time.sleep(1.e-3)
+        await asyncio.sleep(_SOCK_TIME_DELAY)
     return msg