Comparison

net/server_select.lua @ 3000:43a4cb707fe4

net.server_select, net.server_event: Support for :pause() and :resume() on connections
author Matthew Wild <mwild1@gmail.com>
date Wed, 05 May 2010 15:21:17 +0100
parent 2970:9b8e139eff5f
child 3001:fa00c6f563b4
comparison
equal deleted inserted replaced
2988:0c61f73ac0fb 3000:43a4cb707fe4
390 handler.bufferlen = function( self, readlen, sendlen ) 390 handler.bufferlen = function( self, readlen, sendlen )
391 maxsendlen = sendlen or maxsendlen 391 maxsendlen = sendlen or maxsendlen
392 maxreadlen = readlen or maxreadlen 392 maxreadlen = readlen or maxreadlen
393 return bufferlen, maxreadlen, maxsendlen 393 return bufferlen, maxreadlen, maxsendlen
394 end 394 end
395 --TODO: Deprecate
395 handler.lock_read = function (self, switch) 396 handler.lock_read = function (self, switch)
396 if switch == true then 397 if switch == true then
397 local tmp = _readlistlen 398 local tmp = _readlistlen
398 _readlistlen = removesocket( _readlist, socket, _readlistlen ) 399 _readlistlen = removesocket( _readlist, socket, _readlistlen )
399 _readtimes[ handler ] = nil 400 _readtimes[ handler ] = nil
406 _readlistlen = addsocket(_readlist, socket, _readlistlen) 407 _readlistlen = addsocket(_readlist, socket, _readlistlen)
407 _readtimes[ handler ] = _currenttime 408 _readtimes[ handler ] = _currenttime
408 end 409 end
409 end 410 end
410 return noread 411 return noread
412 end
413 handler.pause = function (self)
414 return self:lock_read(true);
415 end
416 handler.resume = function (self)
417 return self:lock_read(false);
411 end 418 end
412 handler.lock = function( self, switch ) 419 handler.lock = function( self, switch )
413 handler.lock_read (switch) 420 handler.lock_read (switch)
414 if switch == true then 421 if switch == true then
415 handler.write = idfalse 422 handler.write = idfalse