"send" event on SentLines should be run on the main thread

This commit is contained in:
jesopo 2019-06-07 11:05:43 +01:00
parent b3b4d07e63
commit 09fbbae5e3
2 changed files with 2 additions and 3 deletions

View file

@ -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)

View file

@ -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:]