Comparison

core/s2smanager.lua @ 2621:4d0f9f50fdd8

sessionmanager, s2smanager: Give sessions dummy data handlers that log when data is received by a destroyed session
author Matthew Wild <mwild1@gmail.com>
date Fri, 12 Feb 2010 17:14:54 +0000
parent 2613:afa20941e098
child 2622:5ced53147f86
comparison
equal deleted inserted replaced
2620:481c6724818f 2621:4d0f9f50fdd8
506 506
507 session.srv_hosts = nil; 507 session.srv_hosts = nil;
508 end 508 end
509 end 509 end
510 510
511 local function null_data_handler(data) log("debug", "Discarding data from destroyed s2s session: %s", data); end
512
511 function destroy_session(session, reason) 513 function destroy_session(session, reason)
512 (session.log or log)("info", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host)); 514 (session.log or log)("info", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host));
513 515
514 if session.direction == "outgoing" then 516 if session.direction == "outgoing" then
515 hosts[session.from_host].s2sout[session.to_host] = nil; 517 hosts[session.from_host].s2sout[session.to_host] = nil;
521 for k in pairs(session) do 523 for k in pairs(session) do
522 if k ~= "trace" then 524 if k ~= "trace" then
523 session[k] = nil; 525 session[k] = nil;
524 end 526 end
525 end 527 end
528 session.data = null_data_handler;
526 end 529 end
527 530
528 return _M; 531 return _M;