mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-09 00:14:50 +00:00
Workaround the occasional delayed stop of a Client instance
This commit is contained in:
parent
b9c50b0ae0
commit
2ba921c84d
1 changed files with 4 additions and 0 deletions
|
|
@ -19,6 +19,7 @@
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
|
import time
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import socks
|
import socks
|
||||||
|
|
@ -72,6 +73,9 @@ class TCP(socks.socksocket):
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
finally:
|
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()
|
super().close()
|
||||||
|
|
||||||
def recvall(self, length: int) -> bytes or None:
|
def recvall(self, length: int) -> bytes or None:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue