From 09fbbae5e3b36d2d1753c755da1bfe5848c4dfb7 Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 7 Jun 2019 11:05:43 +0100 Subject: [PATCH] "send" event on SentLines should be run on the main thread --- src/IRCServer.py | 1 + src/IRCSocket.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/IRCServer.py b/src/IRCServer.py index 795ccaac..bece7609 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -248,6 +248,7 @@ class Server(IRCObject.Object): return lines def _post_send(self, lines: typing.List[IRCLine.SentLine]): for line in lines: + line.events.on("send").call() self.events.on("raw.send").call_unsafe(server=self, line=line.parsed_line) diff --git a/src/IRCSocket.py b/src/IRCSocket.py index 19c72f7e..886cfe4a 100644 --- a/src/IRCSocket.py +++ b/src/IRCSocket.py @@ -149,9 +149,7 @@ class Socket(IRCObject.Object): sent_lines_count = bytes_written.count(b"\r\n") sent_lines = [] # type: typing.List[IRCLine.SentLine] for i in range(sent_lines_count): - sent_line = self._buffered_lines.pop(0) - sent_line.events.on("send").call() - sent_lines.append(sent_line) + sent_lines.append(self._buffered_lines.pop(0)) self._write_buffer = self._write_buffer[bytes_written_i:]