X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=net%2Fserver_select.lua;h=7ac4152314cca2068f711b3f8865fbe5371b73d3;hb=refs%2Fheads%2Fnohangouts-0.9.7;hp=e896451830d3c85c06d8721d8954528bf20f8112;hpb=a25e0525a9e4ebe285498e0b09b39423c24d3725;p=prosody.git diff --git a/net/server_select.lua b/net/server_select.lua index e8964518..7ac41523 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 = listeners.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