diff options
author | Kim Alvefur <zash@zash.se> | 2019-09-29 14:50:04 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-09-29 14:50:04 +0200 |
commit | 2aedce23760830b08c7cdd76b1164f9e6f2fbea9 (patch) | |
tree | f472b6fea5e35e3eee43ab8ab56de223bd59a99d /net | |
parent | fad52c768601de198e5c277d547528bfac1f6166 (diff) | |
download | prosody-2aedce23760830b08c7cdd76b1164f9e6f2fbea9.tar.gz prosody-2aedce23760830b08c7cdd76b1164f9e6f2fbea9.zip |
net.server_epoll: Make it easy to override handler for incoming data
Diffstat (limited to 'net')
-rw-r--r-- | net/server_epoll.lua | 9 |
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); |