Software /
code /
prosody
Comparison
net/server.lua @ 98:3a2d327c4856
server.lua should degrade gracefully when LuaSec not present
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 17:27:40 +0100 |
parent | 74:09bda2782837 |
child | 127:93f3c6b94c75 |
comparison
equal
deleted
inserted
replaced
97:c3f12fd0c823 | 98:3a2d327c4856 |
---|---|
41 local out_put = function () end --print; | 41 local out_put = function () end --print; |
42 local out_error = print; | 42 local out_error = print; |
43 | 43 |
44 --// extern libs //-- | 44 --// extern libs //-- |
45 | 45 |
46 local luasec = require "ssl" | 46 local luasec = select(2, pcall(require, "ssl")) |
47 local luasocket = require "socket" | 47 local luasocket = require "socket" |
48 | 48 |
49 --// extern lib methods //-- | 49 --// extern lib methods //-- |
50 | 50 |
51 local ssl_wrap = ( luasec and luasec.wrap ) | 51 local ssl_wrap = ( luasec and luasec.wrap ) |
720 if type( listeners ) ~= "table" then | 720 if type( listeners ) ~= "table" then |
721 err = "invalid listener table" | 721 err = "invalid listener table" |
722 else | 722 else |
723 for name, func in pairs( listeners ) do | 723 for name, func in pairs( listeners ) do |
724 if type( func ) ~= "function" then | 724 if type( func ) ~= "function" then |
725 err = "invalid listener function" | 725 --err = "invalid listener function" |
726 break | 726 break |
727 end | 727 end |
728 end | 728 end |
729 end | 729 end |
730 if not type( port ) == "number" or not ( port >= 0 and port <= 65535 ) then | 730 if not type( port ) == "number" or not ( port >= 0 and port <= 65535 ) then |