Comparison

net/server_select.lua @ 2478:7be72eca5666

net.server_{select,event}: Fail gracefully if socket doesn't have a setoption method (LuaSec issue I think)
author Matthew Wild <mwild1@gmail.com>
date Thu, 21 Jan 2010 12:56:08 +0000
parent 2452:2a51031c9ca3
child 2541:2febd008214e
comparison
equal deleted inserted replaced
2477:a08ba94c2a29 2478:7be72eca5666
352 end 352 end
353 handler.shutdown = function( pattern ) 353 handler.shutdown = function( pattern )
354 return shutdown( socket, pattern ) 354 return shutdown( socket, pattern )
355 end 355 end
356 handler.setoption = function (self, option, value) 356 handler.setoption = function (self, option, value)
357 return socket:setoption(option, value); 357 if socket.setoption then
358 return socket:setoption(option, value);
359 end
360 return false, "setoption not implemented";
358 end 361 end
359 handler.close = function( self, forced ) 362 handler.close = function( self, forced )
360 if not handler then return true; end 363 if not handler then return true; end
361 _readlistlen = removesocket( _readlist, socket, _readlistlen ) 364 _readlistlen = removesocket( _readlist, socket, _readlistlen )
362 _readtimes[ handler ] = nil 365 _readtimes[ handler ] = nil