瀏覽代碼

ircd/meetbot: Always flush buffers

Luther Blissett 3 年之前
父節點
當前提交
b1c6cdde85
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      bin/ircd/script/meetbot.py

+ 5 - 1
bin/ircd/script/meetbot.py

@@ -25,18 +25,22 @@ async def channel_listen(host, port, nick, chan):
         logging.debug("%s: Send CAP msg", chan)
         msg = "CAP REQ : no-history\r\n"
         writer.write(msg.encode("utf-8"))
+        await writer.drain()
 
         logging.debug("%s: Send NICK msg", chan)
         msg = f"NICK {nick}\r\n"
         writer.write(msg.encode("utf-8"))
+        await writer.drain()
 
         logging.debug("%s: Send CAP END msg", chan)
         msg = "CAP END\r\n"
         writer.write(msg.encode("utf-8"))
+        await writer.drain()
 
         logging.debug("%s: Send JOIN msg", chan)
         msg = f"JOIN {chan}\r\n"
         writer.write(msg.encode("utf-8"))
+        await writer.drain()
 
         logging.info("%s: Listening to channel", chan)
         while True:
@@ -167,7 +171,7 @@ async def channel_listen(host, port, nick, chan):
                     continue
 
     except KeyboardInterrupt:
-        pass
+        return
     except ConnectionRefusedError:
         logging.warning("%s: Connection refused, trying again in 3s...", chan)
         await asyncio.sleep(3)