Changeset

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
parents 2161:6f91d5348847
children 2164:339a96689dcb
files net/server.lua
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/server.lua	Mon Nov 23 20:22:37 2009 +0000
+++ b/net/server.lua	Tue Nov 24 14:37:14 2009 +0500
@@ -1,9 +1,16 @@
-local have_luaevent = pcall(require, "luaevent.core");
+
 local use_luaevent = require "core.configmanager".get("*", "core", "use_libevent");
 
+if use_luaevent then
+	use_luaevent = pcall(require, "luaevent.core");
+	if not use_luaevent then
+		log("error", "libevent not found, falling back to select()");
+	end
+end
+
 local server;
 
-if have_luaevent and use_luaevent == true then
+if use_luaevent then
 	server = require "net.server_event";
 	-- util.timer requires "net.server", so instead of having
 	-- Lua look for, and load us again (causing a loop) - set this here