Comparison

net/server_select.lua @ 5846:b8c7656481ac

server_select: fix onreadtimeout support so that listeners can override the default (disconnect) behaviour
author Matthew Wild <mwild1@gmail.com>
date Sat, 28 Sep 2013 18:40:48 +0100
parent 5824:6f4c8af128e2
child 5950:bd1d1c29a7e7
comparison
equal deleted inserted replaced
5845:c48f717c2fd6 5846:b8c7656481ac
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 onreadtimeout = listeners.onreadtimeout;
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
310 return dispatch 311 return dispatch
311 end 312 end
312 handler.disconnect = function( ) 313 handler.disconnect = function( )
313 return disconnect 314 return disconnect
314 end 315 end
316 handler.onreadtimeout = onreadtimeout;
317
315 handler.setlistener = function( self, listeners ) 318 handler.setlistener = function( self, listeners )
316 dispatch = listeners.onincoming 319 dispatch = listeners.onincoming
317 disconnect = listeners.ondisconnect 320 disconnect = listeners.ondisconnect
318 status = listeners.onstatus 321 status = listeners.onstatus
319 drain = listeners.ondrain 322 drain = listeners.ondrain
323 handler.onreadtimeout = listeners.onreadtimeout
320 end 324 end
321 handler.getstats = function( ) 325 handler.getstats = function( )
322 return readtraffic, sendtraffic 326 return readtraffic, sendtraffic
323 end 327 end
324 handler.ssl = function( ) 328 handler.ssl = function( )