Software / code / prosody
Comparison
plugins/mod_admin_socket.lua @ 10862:1cfae9e85021
mod_admin_socket: Use wrapserver if available
Why have a custom accept function when this is net.server's entire
thing?
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 01 Jun 2020 17:27:50 +0200 |
| parent | 10855:70ac7d23673d |
| child | 10866:5265f7fe11dd |
comparison
equal
deleted
inserted
replaced
| 10861:e12690a37795 | 10862:1cfae9e85021 |
|---|---|
| 53 sock = unix.stream(); | 53 sock = unix.stream(); |
| 54 sock:settimeout(0); | 54 sock:settimeout(0); |
| 55 os.remove(socket_path); | 55 os.remove(socket_path); |
| 56 assert(sock:bind(socket_path)); | 56 assert(sock:bind(socket_path)); |
| 57 assert(sock:listen()); | 57 assert(sock:listen()); |
| 58 conn = server.watchfd(sock:getfd(), accept_connection); | 58 if server.wrapserver then |
| 59 conn = server.wrapserver(sock, socket_path, 0, listeners); | |
| 60 else | |
| 61 conn = server.watchfd(sock:getfd(), accept_connection); | |
| 62 end | |
| 59 end | 63 end |
| 60 | 64 |
| 61 function module.unload() | 65 function module.unload() |
| 62 if conn then | 66 if conn then |
| 63 conn:close(); | 67 conn:close(); |