comparison plugins/mod_ping.lua @ 10654:a2bd6e85a457

mod_ping: Fix double response to internal ping When responding to a ping from elsewhere in the same Prosody the send function will be host_send from core.hostmanager, which does not return anything. Tailcalling it therefore lets the iq event fall trough to handle_unhandled_stanza in core.stanza_router, which responds with an error. This error also goes into handle_unhandled_stanza which discards it. Noticed because I have a module that points out when a stanza error reply is created without a text argument.
author Kim Alvefur <zash@zash.se>
date Fri, 21 Feb 2020 23:30:47 +0100
parents 270cb2821566
children 74b9e05af71e
comparison
equal deleted inserted replaced
10653:94f6fb21a764 10654:a2bd6e85a457
9 local st = require "util.stanza"; 9 local st = require "util.stanza";
10 10
11 module:add_feature("urn:xmpp:ping"); 11 module:add_feature("urn:xmpp:ping");
12 12
13 local function ping_handler(event) 13 local function ping_handler(event)
14 return event.origin.send(st.reply(event.stanza)); 14 event.origin.send(st.reply(event.stanza));
15 return true;
15 end 16 end
16 17
17 module:hook("iq-get/bare/urn:xmpp:ping:ping", ping_handler); 18 module:hook("iq-get/bare/urn:xmpp:ping:ping", ping_handler);
18 module:hook("iq-get/host/urn:xmpp:ping:ping", ping_handler); 19 module:hook("iq-get/host/urn:xmpp:ping:ping", ping_handler);