Comparison

plugins/mod_s2s.lua @ 12679:7d4a95ba9b6c 0.12

mod_s2s: Fix firing buffer drain events Fixes the same kind of issue as in 65563530375b but once and for all, while improving similarity between incoming and outgoing connections.
author Kim Alvefur <zash@zash.se>
date Fri, 26 Aug 2022 18:53:00 +0200
parent 12474:8fac32810144
child 12680:ca4abc6ab208
child 13110:d5f322dd424b
comparison
equal deleted inserted replaced
12637:2200f0c6b3f1 12679:7d4a95ba9b6c
462 session:close({ condition = "improper-addressing", text = "New stream 'from' attribute does not match original" }); 462 session:close({ condition = "improper-addressing", text = "New stream 'from' attribute does not match original" });
463 return; 463 return;
464 end 464 end
465 if session.type == "s2sin_unauthed" and to and not session.to_host then 465 if session.type == "s2sin_unauthed" and to and not session.to_host then
466 session.to_host = to; 466 session.to_host = to;
467 session.host = to;
467 elseif to ~= session.to_host then 468 elseif to ~= session.to_host then
468 session:close({ condition = "improper-addressing", text = "New stream 'to' attribute does not match original" }); 469 session:close({ condition = "improper-addressing", text = "New stream 'to' attribute does not match original" });
469 return; 470 return;
470 end 471 end
471 472
886 end 887 end
887 888
888 function listener.onreadtimeout(conn) 889 function listener.onreadtimeout(conn)
889 local session = sessions[conn]; 890 local session = sessions[conn];
890 if session then 891 if session then
891 local host = session.host or session.to_host; 892 return (hosts[session.host] or prosody).events.fire_event("s2s-read-timeout", { session = session });
892 return (hosts[host] or prosody).events.fire_event("s2s-read-timeout", { session = session });
893 end 893 end
894 end 894 end
895 895
896 function listener.ondrain(conn) 896 function listener.ondrain(conn)
897 local session = sessions[conn]; 897 local session = sessions[conn];