Merge 0.10->trunk
[prosody.git] / net / server.lua
index 163b44765e9b26daa2694d34c48b4185cf14eb21..a753a19c8056e7fb7e75c6d6c13ac3ffab0d02cd 100644 (file)
@@ -13,7 +13,6 @@ end
 
 if server_type == "event" then
        if not pcall(require, "luaevent.core") then
-               print(log)
                log("error", "libevent not found, falling back to select()");
                server_type = "select"
        end
@@ -67,9 +66,9 @@ else
 end
 
 -- If server.hook_signal exists, replace signal.signal()
-local ok, signal = pcall(require, "util.signal");
-if server.hook_signal then
-       if ok then
+local has_signal, signal = pcall(require, "util.signal");
+if has_signal then
+       if server.hook_signal then
                function signal.signal(signal_id, handler)
                        if type(signal_id) == "string" then
                                signal_id = signal[signal_id:upper()];
@@ -79,9 +78,15 @@ if server.hook_signal then
                        end
                        return server.hook_signal(signal_id, handler);
                end
+       else
+               server.hook_signal = signal.signal;
        end
 else
-       server.hook_signal = signal.signal;
+       if not server.hook_signal then
+               server.hook_signal = function()
+                       return false, "signal hooking not supported"
+               end
+       end
 end
 
 if prosody then