Comparison

net/server.lua @ 731:c29cf3ffa3fc

Fixed server.lua to use prosody logger for errors
author Matthew Wild <mwild1@gmail.com>
date Fri, 16 Jan 2009 05:36:39 +0000
parent 659:c424bec771d9
child 739:1def06cd9311
comparison
equal deleted inserted replaced
730:ac951c44751c 731:c29cf3ffa3fc
34 local table_remove = table.remove 34 local table_remove = table.remove
35 local string_sub = use'string'.sub 35 local string_sub = use'string'.sub
36 local coroutine_wrap = coroutine.wrap 36 local coroutine_wrap = coroutine.wrap
37 local coroutine_yield = coroutine.yield 37 local coroutine_yield = coroutine.yield
38 local print = print; 38 local print = print;
39
40 local log = require "util.logger".init("server");
39 local out_put = function () end --print; 41 local out_put = function () end --print;
40 local out_error = print; 42 local out_error = function (...) log("error", table_concat({...}, " ")); end
41 43
42 --// extern libs //-- 44 --// extern libs //--
43 45
44 local luasec = select(2, pcall(require, "ssl")) 46 local luasec = select(2, pcall(require, "ssl"))
45 local luasocket = require "socket" 47 local luasocket = require "socket"
795 return nil, err 797 return nil, err
796 end 798 end
797 addr = addr or "*" 799 addr = addr or "*"
798 local server, err = socket_bind( addr, port ) 800 local server, err = socket_bind( addr, port )
799 if err then 801 if err then
800 out_error( "server.lua: ", err ) 802 out_error( addr..":"..port.." -", err )
801 return nil, err 803 return nil, err
802 end 804 end
803 local handler, err = wrapserver( listeners, server, addr, port, mode, sslctx, wrapper_function ) -- wrap new server socket 805 local handler, err = wrapserver( listeners, server, addr, port, mode, sslctx, wrapper_function ) -- wrap new server socket
804 if not handler then 806 if not handler then
805 server:close( ) 807 server:close( )