Software / code / prosody
Comparison
plugins/mod_admin_socket.lua @ 12392:5373724e08a5 0.12
mod_admin_socket: Compat for luasocket prior to unix datagram support
The "socket.unix" module exported only a function before
https://github.com/lunarmodules/luasocket/commit/aa1b8cc9bc35e56de15eeb153c899e4c51de82a8
when datagram support was added.
Fixes #1717
Thanks rsc and lucas for reporting and testing
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 15 Mar 2022 10:48:46 +0100 |
| parent | 10866:5265f7fe11dd |
| child | 12393:6966026262f4 |
comparison
equal
deleted
inserted
replaced
| 12391:a15647d42880 | 12392:5373724e08a5 |
|---|---|
| 1 module:set_global(); | 1 module:set_global(); |
| 2 | 2 |
| 3 local have_unix, unix = pcall(require, "socket.unix"); | 3 local have_unix, unix = pcall(require, "socket.unix"); |
| 4 | 4 |
| 5 if have_unix and type(unix) == "function" then | |
| 6 unix = { stream = unix }; | |
| 7 end | |
| 5 if not have_unix or type(unix) ~= "table" then | 8 if not have_unix or type(unix) ~= "table" then |
| 6 module:log_status("error", "LuaSocket unix socket support not available or incompatible, ensure it is up to date"); | 9 module:log_status("error", "LuaSocket unix socket support not available or incompatible, ensure it is up to date"); |
| 7 return; | 10 return; |
| 8 end | 11 end |
| 9 | 12 |