diff options
author | Kim Alvefur <zash@zash.se> | 2018-10-25 15:12:59 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-10-25 15:12:59 +0200 |
commit | 031dc2e2a0450b25e16bbc534b29522e0ee52793 (patch) | |
tree | f10f829a3a201917528af2117ebe78b410d1fab8 /net/server_event.lua | |
parent | e1846ef9a35e2e91a3c844ef489be780811aa1b0 (diff) | |
download | prosody-031dc2e2a0450b25e16bbc534b29522e0ee52793.tar.gz prosody-031dc2e2a0450b25e16bbc534b29522e0ee52793.zip |
net.server: Add an API for holding writes of outgoing data
Diffstat (limited to 'net/server_event.lua')
-rw-r--r-- | net/server_event.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/server_event.lua b/net/server_event.lua index ca80c3f2..70757e03 100644 --- a/net/server_event.lua +++ b/net/server_event.lua @@ -273,6 +273,19 @@ function interface_mt:resume() 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 |