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 | ff41d8ed2af5324b8f439a6864e41505ab778080 (patch) | |
tree | 238b8a7c17812328bb40a60dc6f31db7b74a3194 /net | |
parent | 96fc243b44f51b5b120431aff6d2d2bbbc4d5f71 (diff) | |
download | prosody-ff41d8ed2af5324b8f439a6864e41505ab778080.tar.gz prosody-ff41d8ed2af5324b8f439a6864e41505ab778080.zip |
net/server: Handle lack of util.signal correctly
Diffstat (limited to 'net')
-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 |