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
commit0926e4557e9600392e4ad335239b399e0baa953f (patch)
treef91c70d4e33f77f4ef3a178624d15109f7568374 /net/server_select.lua
parentf7fb69e5e53ce95d14f60d9e51d12fb09d15479c (diff)
downloadprosody-0926e4557e9600392e4ad335239b399e0baa953f.tar.gz
prosody-0926e4557e9600392e4ad335239b399e0baa953f.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