add IRCServer.clear_send_buffer() to clear queued lines

This commit is contained in:
jesopo 2019-03-05 11:34:22 +00:00
parent 91c2ab03ba
commit 11c4d70156
2 changed files with 4 additions and 0 deletions

View file

@ -19,6 +19,7 @@ class Module(ModuleManager.BaseModule):
self.events.on("signal.interrupt").call(signum=signum) self.events.on("signal.interrupt").call(signum=signum)
for server in self.bot.servers.values(): for server in self.bot.servers.values():
server.socket.clear_send_buffer()
line = server.send_quit("Shutting down") line = server.send_quit("Shutting down")
server.send_enabled = False server.send_enabled = False
line.on_send(self._make_hook(server)) line.on_send(self._make_hook(server))

View file

@ -148,6 +148,9 @@ class Socket(IRCObject.Object):
return sent_lines return sent_lines
def clear_send_buffer(self):
self._queued_lines.clear()
def waiting_send(self) -> bool: def waiting_send(self) -> bool:
return bool(len(self._write_buffer)) or bool(len(self._queued_lines)) return bool(len(self._write_buffer)) or bool(len(self._queued_lines))