mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-05 23:04:51 +00:00
Attempt to fix handler is closed
Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
parent
921b593285
commit
e3a8a781d3
1 changed files with 5 additions and 3 deletions
|
|
@ -134,12 +134,14 @@ class TCP:
|
||||||
await asyncio.wait_for(self.writer.wait_closed(), TCP.TIMEOUT)
|
await asyncio.wait_for(self.writer.wait_closed(), TCP.TIMEOUT)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.info("Close exception: %s %s", type(e).__name__, e)
|
log.info("Close exception: %s %s", type(e).__name__, e)
|
||||||
|
finally:
|
||||||
|
self.writer = None
|
||||||
|
|
||||||
async def send(self, data: bytes) -> None:
|
async def send(self, data: bytes) -> None:
|
||||||
if self.writer is None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
async with self.lock:
|
async with self.lock:
|
||||||
|
if self.writer is None or self.writer.is_closing():
|
||||||
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.writer.write(data)
|
self.writer.write(data)
|
||||||
await self.writer.drain()
|
await self.writer.drain()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue