mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-30 17:43:32 +00:00
Raise and handle send errors in order to immediately act upon
This commit is contained in:
parent
5ca422b314
commit
1daa05a35c
@ -101,6 +101,7 @@ class TCP:
|
|||||||
await self.writer.drain()
|
await self.writer.drain()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warning("Send exception: %s %s", type(e).__name__, e)
|
log.warning("Send exception: %s %s", type(e).__name__, e)
|
||||||
|
raise OSError(e)
|
||||||
|
|
||||||
async def recv(self, length: int = 0):
|
async def recv(self, length: int = 0):
|
||||||
data = b""
|
data = b""
|
||||||
|
@ -297,7 +297,11 @@ class Session:
|
|||||||
self.auth_key_id
|
self.auth_key_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
await self.connection.send(payload)
|
await self.connection.send(payload)
|
||||||
|
except OSError as e:
|
||||||
|
self.results.pop(msg_id, None)
|
||||||
|
raise e
|
||||||
|
|
||||||
if wait_response:
|
if wait_response:
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user