aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_select.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2014-08-29 11:39:56 +0100
committerMatthew Wild <mwild1@gmail.com>2014-08-29 11:39:56 +0100
commita9f0fe436fe6427addf0c10fe7d02ac921a5c50b (patch)
treef91c70d4e33f77f4ef3a178624d15109f7568374 /net/server_select.lua
parent316e35bb4f68a30174276fdc053a49f16aeca8ca (diff)
downloadprosody-a9f0fe436fe6427addf0c10fe7d02ac921a5c50b.tar.gz
prosody-a9f0fe436fe6427addf0c10fe7d02ac921a5c50b.zip
net.server_{select,event}: Add 'ondetach' callback for listener objects, to notify them when another listener is being assigned to a connection
Diffstat (limited to 'net/server_select.lua')
-rw-r--r--net/server_select.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index e8964518..2b23b4f0 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -284,6 +284,7 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
local status = listeners.onstatus
local disconnect = listeners.ondisconnect
local drain = listeners.ondrain
+ local detach = listener.ondetach
local bufferqueue = { } -- buffer array
local bufferqueuelen = 0 -- end of buffer array
@@ -313,10 +314,14 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
return disconnect
end
handler.setlistener = function( self, listeners )
+ if detach then
+ detach(self) -- Notify listener that it is no longer responsible for this connection
+ end
dispatch = listeners.onincoming
disconnect = listeners.ondisconnect
status = listeners.onstatus
drain = listeners.ondrain
+ detach = listeners.ondetach
end
handler.getstats = function( )
return readtraffic, sendtraffic