prosody

changeset 843
1d2dab41b0db
parent 793
55add3b87c01
child 853
c0a40522041e
equal deleted inserted replaced
842:4932f94d35c1 843:1d2dab41b0db
5 -- 5 --
6 -- This project is MIT/X11 licensed. Please see the 6 -- This project is MIT/X11 licensed. Please see the
7 -- COPYING file in the source package for more information. 7 -- COPYING file in the source package for more information.
8 -- 8 --
9 9
10 -- Config here -- 10 -- Will be modified by configure script if run --
11 11
12 CFG_SOURCEDIR=nil; 12 CFG_SOURCEDIR=nil;
13 CFG_CONFIGDIR=os.getenv("PROSODY_CFGDIR"); 13 CFG_CONFIGDIR=os.getenv("PROSODY_CFGDIR");
14 CFG_PLUGINDIR=nil; 14 CFG_PLUGINDIR=nil;
15 CFG_DATADIR=os.getenv("PROSODY_DATADIR"); 15 CFG_DATADIR=os.getenv("PROSODY_DATADIR");
16 16
17 -- -- -- -- -- -- 17 -- -- -- -- -- -- -- ---- -- -- -- -- -- -- -- --
18 18
19 if CFG_SOURCEDIR then 19 if CFG_SOURCEDIR then
20 package.path = CFG_SOURCEDIR.."/?.lua;"..package.path 20 package.path = CFG_SOURCEDIR.."/?.lua;"..package.path
21 package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath 21 package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath
22 end 22 end
82 require "core.modulemanager" 82 require "core.modulemanager"
83 require "core.usermanager" 83 require "core.usermanager"
84 require "core.sessionmanager" 84 require "core.sessionmanager"
85 require "core.stanza_router" 85 require "core.stanza_router"
86 86
87 --[[ 87 -- Commented to protect us from
88 -- the second kind of people
89 --[[
88 pcall(require, "remdebug.engine"); 90 pcall(require, "remdebug.engine");
89 if remdebug then remdebug.engine.start() end 91 if remdebug then remdebug.engine.start() end
90 ]] 92 ]]
91 93
92 local cl = require "net.connlisteners"; 94 local cl = require "net.connlisteners";
101 103
102 local data_path = config.get("*", "core", "data_path") or CFG_DATADIR or "data"; 104 local data_path = config.get("*", "core", "data_path") or CFG_DATADIR or "data";
103 require "util.datamanager".set_data_path(data_path); 105 require "util.datamanager".set_data_path(data_path);
104 106
105 ----------- End of out-of-place code -------------- 107 ----------- End of out-of-place code --------------
108
106 109
107 eventmanager.fire_event("server-starting"); 110 eventmanager.fire_event("server-starting");
108 111
109 112
110 -- setup error handling 113 -- setup error handling
146 end 149 end
147 end 150 end
148 151
149 eventmanager.fire_event("server-started"); 152 eventmanager.fire_event("server-started");
150 153
151 server.loop(); 154 local quitting;
155 while not quitting do
156 xpcall(server.loop, function (err)
157 if err:match("%d*: interrupted!$") then
158 quitting = true;
159 return;
160 end
161 eventmanager.fire_event("very-bad-error", "*", err, debug.traceback("", 2));
162 end);
163 end

mercurial