aboutsummaryrefslogtreecommitdiffstats
path: root/prosody
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-02-27 04:35:36 +0000
committerMatthew Wild <mwild1@gmail.com>2009-02-27 04:35:36 +0000
commit9122c9bfbba618ac47c0c5ae04c0db713ff1ed95 (patch)
treee06a102c92d61e4752f040315b352df3d6f6f592 /prosody
parent0c8bb8e89f63fe33e7a320e5d8bb308c1ba80192 (diff)
downloadprosody-9122c9bfbba618ac47c0c5ae04c0db713ff1ed95.tar.gz
prosody-9122c9bfbba618ac47c0c5ae04c0db713ff1ed95.zip
prosody: Protect main loop. Dare I say crashing finally becomes impossible.
Diffstat (limited to 'prosody')
-rwxr-xr-xprosody20
1 files changed, 16 insertions, 4 deletions
diff --git a/prosody b/prosody
index 197446e6..9a9bb683 100755
--- a/prosody
+++ b/prosody
@@ -7,14 +7,14 @@
-- COPYING file in the source package for more information.
--
--- Config here --
+-- Will be modified by configure script if run --
CFG_SOURCEDIR=nil;
CFG_CONFIGDIR=os.getenv("PROSODY_CFGDIR");
CFG_PLUGINDIR=nil;
CFG_DATADIR=os.getenv("PROSODY_DATADIR");
--- -- -- -- -- --
+-- -- -- -- -- -- -- ---- -- -- -- -- -- -- -- --
if CFG_SOURCEDIR then
package.path = CFG_SOURCEDIR.."/?.lua;"..package.path
@@ -84,7 +84,9 @@ require "core.usermanager"
require "core.sessionmanager"
require "core.stanza_router"
---[[
+-- Commented to protect us from
+-- the second kind of people
+--[[
pcall(require, "remdebug.engine");
if remdebug then remdebug.engine.start() end
]]
@@ -104,6 +106,7 @@ require "util.datamanager".set_data_path(data_path);
----------- End of out-of-place code --------------
+
eventmanager.fire_event("server-starting");
@@ -148,4 +151,13 @@ end
eventmanager.fire_event("server-started");
-server.loop();
+local quitting;
+while not quitting do
+ xpcall(server.loop, function (err)
+ if err:match("%d*: interrupted!$") then
+ quitting = true;
+ return;
+ end
+ eventmanager.fire_event("very-bad-error", "*", err, debug.traceback("", 2));
+ end);
+end