Software /
code /
prosody-modules
Comparison
mod_log_json/mod_log_json.lua @ 3748:27abf3b6819a
mod_log_json: Use correct method to specify remote endpoint
Fun fact, on TCP connections :connect and :setpeername is the same function
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 13 Nov 2019 17:57:54 +0100 |
parent | 3747:f288177f4c5d |
child | 3758:900ea02ab00b |
comparison
equal
deleted
inserted
replaced
3747:f288177f4c5d | 3748:27abf3b6819a |
---|---|
14 function send(payload) | 14 function send(payload) |
15 logfile:write(payload, "\n"); | 15 logfile:write(payload, "\n"); |
16 end | 16 end |
17 elseif config.udp_host and config.udp_port then | 17 elseif config.udp_host and config.udp_port then |
18 local conn = socket.udp(); | 18 local conn = socket.udp(); |
19 conn:connect(config.udp_host, config.udp_port); | 19 conn:setpeername(config.udp_host, config.udp_port); |
20 function send(payload) | 20 function send(payload) |
21 conn:send(payload); | 21 conn:send(payload); |
22 end | 22 end |
23 end | 23 end |
24 return function (source, level, message, ...) | 24 return function (source, level, message, ...) |