Software /
code /
prosody
Changeset
9387:33e52f727f0f
net.connect: Fix passing request table to new listener
This could be a return value from ondetach
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 26 Sep 2018 17:36:53 +0200 |
parents | 9386:0f395d82b4ea |
children | 9388:a5d11627ce5d |
files | net/connect.lua net/server_epoll.lua net/server_event.lua net/server_select.lua |
diffstat | 4 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/net/connect.lua Wed Sep 26 15:07:25 2018 +0200 +++ b/net/connect.lua Wed Sep 26 17:36:53 2018 +0200 @@ -56,7 +56,7 @@ end pending_connections_map[conn] = nil; p:log("debug", "Successfully connected"); - conn:setlistener(p.listeners); + conn:setlistener(p.listeners, p.data); return p.listeners.onconnect(conn); end
--- a/net/server_epoll.lua Wed Sep 26 15:07:25 2018 +0200 +++ b/net/server_epoll.lua Wed Sep 26 17:36:53 2018 +0200 @@ -136,10 +136,10 @@ end -- Replace the listener and tell the old one -function interface:setlistener(listeners) +function interface:setlistener(listeners, data) self:on("detach"); self.listeners = listeners; - self:on("attach"); + self:on("attach", data); end -- Call a listener callback
--- a/net/server_event.lua Wed Sep 26 15:07:25 2018 +0200 +++ b/net/server_event.lua Wed Sep 26 17:36:53 2018 +0200 @@ -415,7 +415,7 @@ return false, "setoption not implemented"; end -function interface_mt:setlistener(listener) +function interface_mt:setlistener(listener, data) self:ondetach(); -- Notify listener that it is no longer responsible for this connection self.onconnect = listener.onconnect; self.ondisconnect = listener.ondisconnect; @@ -426,7 +426,7 @@ self.ondetach = listener.ondetach; self.onattach = listener.onattach; self.ondrain = listener.ondrain; - self:onattach(); + self:onattach(data); end -- Stub handlers
--- a/net/server_select.lua Wed Sep 26 15:07:25 2018 +0200 +++ b/net/server_select.lua Wed Sep 26 17:36:53 2018 +0200 @@ -321,7 +321,7 @@ end handler.onreadtimeout = onreadtimeout; - handler.setlistener = function( self, listeners ) + handler.setlistener = function( self, listeners, data ) if detach then detach(self) -- Notify listener that it is no longer responsible for this connection end @@ -332,7 +332,7 @@ handler.onreadtimeout = listeners.onreadtimeout detach = listeners.ondetach if listeners.onattach then - listeners.onattach(self) + listeners.onattach(self, data) end end handler.getstats = function( )