mirror of
https://github.com/pyrogram/pyrogram
synced 2025-09-05 00:35:10 +00:00
Workaround the occasional delayed stop of a Client instance
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
import ipaddress
|
||||
import logging
|
||||
import socket
|
||||
import time
|
||||
|
||||
try:
|
||||
import socks
|
||||
@@ -72,6 +73,9 @@ class TCP(socks.socksocket):
|
||||
except OSError:
|
||||
pass
|
||||
finally:
|
||||
# A tiny sleep placed here helps avoiding .recv(n) hanging until the timeout.
|
||||
# This is a workaround that seems to fix the occasional delayed stop of a client.
|
||||
time.sleep(0.001)
|
||||
super().close()
|
||||
|
||||
def recvall(self, length: int) -> bytes or None:
|
||||
|
Reference in New Issue
Block a user