mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
tesmart rewrite
This commit is contained in:
@@ -88,6 +88,19 @@ async def wait_first(*aws: Awaitable) -> Tuple[Set[asyncio.Future], Set[asyncio.
|
||||
return (await asyncio.wait(list(aws), return_when=asyncio.FIRST_COMPLETED))
|
||||
|
||||
|
||||
# =====
|
||||
async def close_writer(writer: asyncio.StreamWriter) -> bool:
|
||||
closing = writer.is_closing()
|
||||
if not closing:
|
||||
writer.transport.abort() # type: ignore
|
||||
writer.close()
|
||||
try:
|
||||
await writer.wait_closed()
|
||||
except Exception:
|
||||
pass
|
||||
return (not closing)
|
||||
|
||||
|
||||
# =====
|
||||
class AioNotifier:
|
||||
def __init__(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user