Software /
code /
prosody
Diff
net/server_event.lua @ 9581:1be99aedb0b3
net.server: Add an API for holding writes of outgoing data
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 25 Oct 2018 15:12:59 +0200 |
parent | 9575:1fb3e7c550bf |
child | 9835:20bf5b47c1fb |
line wrap: on
line diff
--- a/net/server_event.lua Sun Oct 28 17:11:18 2018 +0100 +++ b/net/server_event.lua Thu Oct 25 15:12:59 2018 +0200 @@ -273,6 +273,19 @@ end end +function interface_mt:pause_writes() + return self:_lock(self.nointerface, self.noreading, true); +end + +function interface_mt:resume_writes() + self:_lock(self.nointerface, self.noreading, false); + if self.writecallback and not self.eventwrite then + self.eventwrite = addevent( base, self.conn, EV_WRITE, self.writecallback, cfg.WRITE_TIMEOUT ); -- register callback + return true; + end +end + + function interface_mt:counter(c) if c then self._connections = self._connections + c