diff options
author | Matthew Wild <mwild1@gmail.com> | 2014-08-29 11:39:56 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2014-08-29 11:39:56 +0100 |
commit | 257d0f104b61bac50f946c4eca9bd973110fce5d (patch) | |
tree | f91c70d4e33f77f4ef3a178624d15109f7568374 /net/server_select.lua | |
parent | 4bc9e05c119e883af72963465410c673fab815a6 (diff) | |
download | prosody-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.lua | 5 |
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 |