aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-01-10 15:26:36 +0000
committerMatthew Wild <mwild1@gmail.com>2010-01-10 15:26:36 +0000
commit5b19c141d9572f9dfa4cd955aa981e10a69b5ff5 (patch)
treef06bc040288bc5222da6682a5848b1c46540df11 /net
parent20a9ef356173364f87cef69d4ee285172e7b1b9c (diff)
downloadprosody-5b19c141d9572f9dfa4cd955aa981e10a69b5ff5.tar.gz
prosody-5b19c141d9572f9dfa4cd955aa981e10a69b5ff5.zip
net.server: When libevent backend is in use, override signal.signal to use server.hook_signal
Diffstat (limited to 'net')
-rw-r--r--net/server.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/server.lua b/net/server.lua
index f77b216d..0102cee6 100644
--- a/net/server.lua
+++ b/net/server.lua
@@ -23,6 +23,23 @@ if use_luaevent then
function server.addtimer(f)
return add_task(1, function (...) f(...); return 1; end);
end
+
+ -- Overwrite signal.signal() because we need to ask libevent to
+ -- handle them instead
+ local ok, signal = pcall(require, "util.signal");
+ if ok and signal then
+ local _signal_signal = signal.signal;
+ function signal.signal(signal_id, handler)
+ if type(signal_id) == "string" then
+ signal_id = signal[signal_id:upper()];
+ end
+ if type(signal_id) ~= "number" then
+ return false, "invalid-signal";
+ end
+ --_signal_signal(signal_id, handler);
+ return server.hook_signal(signal_id, handler);
+ end
+ end
else
server = require "net.server_select";
package.loaded["net.server"] = server;