diff options
author | daurnimator <quae@daurnimator.com> | 2014-10-22 16:00:40 -0400 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2014-10-22 16:00:40 -0400 |
commit | f08fe049ef978fdaa00132f238d6f038605ed3a1 (patch) | |
tree | 238b8a7c17812328bb40a60dc6f31db7b74a3194 /net/server.lua | |
parent | 7c48f41f8fb2850bf5b38f3a17e8bc52fd94ce0f (diff) | |
download | prosody-f08fe049ef978fdaa00132f238d6f038605ed3a1.tar.gz prosody-f08fe049ef978fdaa00132f238d6f038605ed3a1.zip |
net/server: Handle lack of util.signal correctly
Diffstat (limited to 'net/server.lua')
-rw-r--r-- | net/server.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/net/server.lua b/net/server.lua index 9f24b0a6..a753a19c 100644 --- a/net/server.lua +++ b/net/server.lua @@ -66,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()]; @@ -78,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 |