Comparison

net/server_select.lua @ 6379:a280bd6ccce2

net.server_{select,event}: Add 'ondetach' callback for listener objects, to notify them when another listener is being assigned to a connection
author Matthew Wild <mwild1@gmail.com>
date Fri, 29 Aug 2014 11:39:56 +0100
parent 6314:8029b8a5f37a
child 6381:9ffd582c65d8
comparison
equal deleted inserted replaced
6378:3cec0eef0b70 6379:a280bd6ccce2
282 282
283 local dispatch = listeners.onincoming 283 local dispatch = listeners.onincoming
284 local status = listeners.onstatus 284 local status = listeners.onstatus
285 local disconnect = listeners.ondisconnect 285 local disconnect = listeners.ondisconnect
286 local drain = listeners.ondrain 286 local drain = listeners.ondrain
287 local detach = listener.ondetach
287 288
288 local bufferqueue = { } -- buffer array 289 local bufferqueue = { } -- buffer array
289 local bufferqueuelen = 0 -- end of buffer array 290 local bufferqueuelen = 0 -- end of buffer array
290 291
291 local toclose 292 local toclose
311 end 312 end
312 handler.disconnect = function( ) 313 handler.disconnect = function( )
313 return disconnect 314 return disconnect
314 end 315 end
315 handler.setlistener = function( self, listeners ) 316 handler.setlistener = function( self, listeners )
317 if detach then
318 detach(self) -- Notify listener that it is no longer responsible for this connection
319 end
316 dispatch = listeners.onincoming 320 dispatch = listeners.onincoming
317 disconnect = listeners.ondisconnect 321 disconnect = listeners.ondisconnect
318 status = listeners.onstatus 322 status = listeners.onstatus
319 drain = listeners.ondrain 323 drain = listeners.ondrain
324 detach = listeners.ondetach
320 end 325 end
321 handler.getstats = function( ) 326 handler.getstats = function( )
322 return readtraffic, sendtraffic 327 return readtraffic, sendtraffic
323 end 328 end
324 handler.ssl = function( ) 329 handler.ssl = function( )