Comparison

plugins/mod_s2s/mod_s2s.lua @ 5638:c5b7f4858014

mod_c2s, mod_c2s: Send a whitespace on read timeout, to prod TCP into detecting if the connection died
author Kim Alvefur <zash@zash.se>
date Thu, 30 May 2013 14:32:40 +0200
parent 5636:d323932ecf18
child 5661:f226a0d23e85
comparison
equal deleted inserted replaced
5637:991b47778bf3 5638:c5b7f4858014
622 (session.log or log)("debug", "s2s disconnected: %s->%s (%s)", tostring(session.from_host), tostring(session.to_host), tostring(err or "connection closed")); 622 (session.log or log)("debug", "s2s disconnected: %s->%s (%s)", tostring(session.from_host), tostring(session.to_host), tostring(err or "connection closed"));
623 s2s_destroy_session(session, err); 623 s2s_destroy_session(session, err);
624 end 624 end
625 end 625 end
626 626
627 function listener.onreadtimeout(conn)
628 local session = sessions[conn];
629 if session then
630 return session.sends2s(' ');
631 end
632 end
633
627 function listener.register_outgoing(conn, session) 634 function listener.register_outgoing(conn, session)
628 session.direction = "outgoing"; 635 session.direction = "outgoing";
629 sessions[conn] = session; 636 sessions[conn] = session;
630 initialize_session(session); 637 initialize_session(session);
631 end 638 end