aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2024-11-09 15:42:31 +0100
committerKim Alvefur <zash@zash.se>2024-11-09 15:42:31 +0100
commit52178d74302b310d5ee986399e7f24d1a02da58d (patch)
tree96190cf5d9f0114ec40809bd7a615fda4f2684c0 /net
parent693079c619ef4d33c90a20979ac5d97b0c2712ec (diff)
downloadprosody-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.
Diffstat (limited to 'net')
-rw-r--r--net/server_epoll.lua6
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