Software / code / prosody
Comparison
core/s2smanager.lua @ 2857:6036c4b75235
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 | 2712:9c579864b20a |
| child | 2858:d08771a2f617 |
comparison
equal
deleted
inserted
replaced
| 2856:70e6ea49aff3 | 2857:6036c4b75235 |
|---|---|
| 489 | 489 |
| 490 session.srv_hosts = nil; | 490 session.srv_hosts = nil; |
| 491 end | 491 end |
| 492 end | 492 end |
| 493 | 493 |
| 494 local function null_data_handler(data) log("debug", "Discarding data from destroyed s2s session: %s", data); end | |
| 495 | |
| 494 function destroy_session(session) | 496 function destroy_session(session) |
| 495 (session.log or log)("info", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host)); | 497 (session.log or log)("info", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host)); |
| 496 | 498 |
| 497 if session.direction == "outgoing" then | 499 if session.direction == "outgoing" then |
| 498 hosts[session.from_host].s2sout[session.to_host] = nil; | 500 hosts[session.from_host].s2sout[session.to_host] = nil; |
| 504 for k in pairs(session) do | 506 for k in pairs(session) do |
| 505 if k ~= "trace" then | 507 if k ~= "trace" then |
| 506 session[k] = nil; | 508 session[k] = nil; |
| 507 end | 509 end |
| 508 end | 510 end |
| 511 session.data = null_data_handler; | |
| 509 end | 512 end |
| 510 | 513 |
| 511 return _M; | 514 return _M; |