Comparison

net/connlisteners.lua @ 2104:466bd2cac62a

net.connlisteners: Standardise on new syntax for addserver(), and clean up a bit
author Matthew Wild <mwild1@gmail.com>
date Sat, 21 Nov 2009 17:11:59 +0000
parent 2076:de2ae849b0b3
child 2546:cadfb455a00c
comparison
equal deleted inserted replaced
2103:0e0bc74c64a0 2104:466bd2cac62a
59 elseif udata.ssl and udata.type == "tcp" then 59 elseif udata.ssl and udata.type == "tcp" then
60 error("SSL context supplied for a TCP connection!", 0); 60 error("SSL context supplied for a TCP connection!", 0);
61 end 61 end
62 end 62 end
63 63
64 return server.addserver(h, 64 local interface = (udata and udata.interface) or h.default_interface or "*";
65 (udata and udata.port) or h.default_port or error("Can't start listener "..name.." because no port was specified, and it has no default port", 0), 65 local port = (udata and udata.port) or h.default_port or error("Can't start listener "..name.." because no port was specified, and it has no default port", 0);
66 (udata and udata.interface) or h.default_interface or "*", (udata and udata.mode) or h.default_mode or 1, (udata and udata.ssl) or nil, 99999999, udata and udata.type == "ssl"); 66 local mode = (udata and udata.mode) or h.default_mode or 1;
67 local ssl = (udata and udata.ssl) or nil;
68 local maxclients = 99999999;
69 local autossl = udata and udata.type == "ssl";
70
71 return server.addserver(interface, port, h, mode, ssl, autossl);
67 end 72 end
68 73
69 return _M; 74 return _M;