Comparison

net/server.lua @ 2162:22b6b1899a55

net.server: Log an error when libevent is requested, but luaevent is unavailable, and don't load luaevent when not requested.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 24 Nov 2009 14:37:14 +0500
parent 2136:23c687039652
child 2281:27441b099984
comparison
equal deleted inserted replaced
2161:6f91d5348847 2162:22b6b1899a55
1 local have_luaevent = pcall(require, "luaevent.core"); 1
2 local use_luaevent = require "core.configmanager".get("*", "core", "use_libevent"); 2 local use_luaevent = require "core.configmanager".get("*", "core", "use_libevent");
3
4 if use_luaevent then
5 use_luaevent = pcall(require, "luaevent.core");
6 if not use_luaevent then
7 log("error", "libevent not found, falling back to select()");
8 end
9 end
3 10
4 local server; 11 local server;
5 12
6 if have_luaevent and use_luaevent == true then 13 if use_luaevent then
7 server = require "net.server_event"; 14 server = require "net.server_event";
8 -- util.timer requires "net.server", so instead of having 15 -- util.timer requires "net.server", so instead of having
9 -- Lua look for, and load us again (causing a loop) - set this here 16 -- Lua look for, and load us again (causing a loop) - set this here
10 -- (usually it isn't set until we return, look down there...) 17 -- (usually it isn't set until we return, look down there...)
11 package.loaded["net.server"] = server; 18 package.loaded["net.server"] = server;