Mercurial > prosody-hg
comparison core/s2smanager.lua @ 10103:18cab054364a
core.s2smanager: Rewrite log line to use formatting instead of concatenation
Makes it more in line with logging elsewhere. Potentially avoids or at
least delays creation of new string.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 30 Jul 2019 02:14:50 +0200 |
| parents | 77a21eef243b |
| children | b36765ab0ae3 |
comparison
equal
deleted
inserted
replaced
| 10102:77a21eef243b | 10103:18cab054364a |
|---|---|
| 7 -- | 7 -- |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| 11 local hosts = prosody.hosts; | 11 local hosts = prosody.hosts; |
| 12 local tostring, pairs, setmetatable | 12 local pairs, setmetatable = pairs, setmetatable; |
| 13 = tostring, pairs, setmetatable; | |
| 14 | 13 |
| 15 local logger_init = require "util.logger".init; | 14 local logger_init = require "util.logger".init; |
| 16 local sessionlib = require "util.session"; | 15 local sessionlib = require "util.session"; |
| 17 | 16 |
| 18 local log = logger_init("s2smanager"); | 17 local log = logger_init("s2smanager"); |
| 82 return setmetatable(session, resting_session); | 81 return setmetatable(session, resting_session); |
| 83 end | 82 end |
| 84 | 83 |
| 85 local function destroy_session(session, reason) | 84 local function destroy_session(session, reason) |
| 86 if session.destroyed then return; end | 85 if session.destroyed then return; end |
| 87 (session.log or log)("debug", "Destroying "..tostring(session.direction) | 86 local log = session.log or log; |
| 88 .." session "..tostring(session.from_host).."->"..tostring(session.to_host) | 87 log("debug", "Destroying %s session %s->%s%s%s", session.direction, session.from_host, session.to_host, reason and ": " or "", reason or ""); |
| 89 ..(reason and (": "..reason) or "")); | |
| 90 | 88 |
| 91 if session.direction == "outgoing" then | 89 if session.direction == "outgoing" then |
| 92 hosts[session.from_host].s2sout[session.to_host] = nil; | 90 hosts[session.from_host].s2sout[session.to_host] = nil; |
| 93 session:bounce_sendq(reason); | 91 session:bounce_sendq(reason); |
| 94 elseif session.direction == "incoming" then | 92 elseif session.direction == "incoming" then |
