aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_epoll.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-09-29 14:50:04 +0200
committerKim Alvefur <zash@zash.se>2019-09-29 14:50:04 +0200
commit2aedce23760830b08c7cdd76b1164f9e6f2fbea9 (patch)
treef472b6fea5e35e3eee43ab8ab56de223bd59a99d /net/server_epoll.lua
parentfad52c768601de198e5c277d547528bfac1f6166 (diff)
downloadprosody-2aedce23760830b08c7cdd76b1164f9e6f2fbea9.tar.gz
prosody-2aedce23760830b08c7cdd76b1164f9e6f2fbea9.zip
net.server_epoll: Make it easy to override handler for incoming data
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r--net/server_epoll.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index f48086e3..fd9e0416 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -189,6 +189,11 @@ function interface:on(what, ...)
return err;
end
+-- Allow this one to be overridden
+function interface:onincoming(...)
+ return self:on("incoming", ...);
+end
+
-- Return the file descriptor number
function interface:getfd()
if self.conn then
@@ -360,7 +365,7 @@ function interface:onreadable()
local data, err, partial = self.conn:receive(self.read_size or cfg.read_size);
if data then
self:onconnect();
- self:on("incoming", data);
+ self:onincoming(data);
else
if err == "wantread" then
self:set(true, nil);
@@ -371,7 +376,7 @@ function interface:onreadable()
end
if partial and partial ~= "" then
self:onconnect();
- self:on("incoming", partial, err);
+ self:onincoming(partial, err);
end
if err ~= "timeout" then
self:on("disconnect", err);