mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Handle TCP server errors
This commit is contained in:
parent
15561d19d5
commit
02da3fe947
@ -337,7 +337,10 @@ class Session:
|
|||||||
while True:
|
while True:
|
||||||
packet = self.connection.recv()
|
packet = self.connection.recv()
|
||||||
|
|
||||||
if packet is None or (len(packet) == 4 and Int.read(BytesIO(packet)) == -404):
|
if packet is None or len(packet) == 4:
|
||||||
|
if packet:
|
||||||
|
log.warning("Server sent \"{}\"".format(Int.read(BytesIO(packet))))
|
||||||
|
|
||||||
if self.is_connected.is_set():
|
if self.is_connected.is_set():
|
||||||
Thread(target=self.restart, name="RestartThread").start()
|
Thread(target=self.restart, name="RestartThread").start()
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user