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
commit257d0f104b61bac50f946c4eca9bd973110fce5d (patch)
treef91c70d4e33f77f4ef3a178624d15109f7568374 /net/server_select.lua
parent4bc9e05c119e883af72963465410c673fab815a6 (diff)
downloadprosody-257d0f104b61bac50f946c4eca9bd973110fce5d.tar.gz
prosody-257d0f104b61bac50f946c4eca9bd973110fce5d.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