diff options
author | Kim Alvefur <zash@zash.se> | 2024-11-09 15:42:31 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2024-11-09 15:42:31 +0100 |
commit | 52178d74302b310d5ee986399e7f24d1a02da58d (patch) | |
tree | 96190cf5d9f0114ec40809bd7a615fda4f2684c0 | |
parent | 693079c619ef4d33c90a20979ac5d97b0c2712ec (diff) | |
download | prosody-52178d74302b310d5ee986399e7f24d1a02da58d.tar.gz prosody-52178d74302b310d5ee986399e7f24d1a02da58d.zip |
net.server_epoll: Make running out of buffer space a fatal error
Prevent Bad Things from happening when the buffer gets full.
This of course opens up the possibility of intentionally killing
connections by sending much stuff, which need to be mitigated with rate
limits elsewhere.
-rw-r--r-- | net/server_epoll.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 89b36233..24678842 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -612,6 +612,8 @@ function interface:write(data) -- Try to flush buffer to make room self:onwritable(); if not buffer:write(prev_buffer) then + self:on("disconnect", "no space left in buffer"); + self:destroy(); return false; end end @@ -622,6 +624,8 @@ function interface:write(data) end self:onwritable(); if not buffer:write(data) then + self:on("disconnect", "no space left in buffer"); + self:destroy(); return false; end end @@ -631,6 +635,8 @@ function interface:write(data) end self:onwritable(); if not buffer:write(data) then + self:on("disconnect", "no space left in buffer"); + self:destroy(); return false; end end |