Mercurial > prosody-hg
comparison plugins/mod_s2s/s2sout.lib.lua @ 4987:d37f2abac72c
mod_s2s/s2sout.lib: Use %s to insert strings into log messages instead of concatenation
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 23 Jul 2012 13:29:33 +0100 |
| parents | ab696f5394cf |
| children | 8b94a8d92cf3 |
comparison
equal
deleted
inserted
replaced
| 4986:9da430b69f13 | 4987:d37f2abac72c |
|---|---|
| 93 local handle; | 93 local handle; |
| 94 handle = adns.lookup(function (answer) | 94 handle = adns.lookup(function (answer) |
| 95 handle = nil; | 95 handle = nil; |
| 96 host_session.connecting = nil; | 96 host_session.connecting = nil; |
| 97 if answer then | 97 if answer then |
| 98 log("debug", to_host.." has SRV records, handling..."); | 98 log("debug", "%s has SRV records, handling...", to_host); |
| 99 local srv_hosts = {}; | 99 local srv_hosts = {}; |
| 100 host_session.srv_hosts = srv_hosts; | 100 host_session.srv_hosts = srv_hosts; |
| 101 for _, record in ipairs(answer) do | 101 for _, record in ipairs(answer) do |
| 102 t_insert(srv_hosts, record.srv); | 102 t_insert(srv_hosts, record.srv); |
| 103 end | 103 end |
| 104 if #srv_hosts == 1 and srv_hosts[1].target == "." then | 104 if #srv_hosts == 1 and srv_hosts[1].target == "." then |
| 105 log("debug", to_host.." does not provide a XMPP service"); | 105 log("debug", "%s does not provide a XMPP service", to_host); |
| 106 s2s_destroy_session(host_session, err); -- Nothing to see here | 106 s2s_destroy_session(host_session, err); -- Nothing to see here |
| 107 return; | 107 return; |
| 108 end | 108 end |
| 109 t_sort(srv_hosts, compare_srv_priorities); | 109 t_sort(srv_hosts, compare_srv_priorities); |
| 110 | 110 |
| 113 if srv_choice then | 113 if srv_choice then |
| 114 connect_host, connect_port = srv_choice.target or to_host, srv_choice.port or connect_port; | 114 connect_host, connect_port = srv_choice.target or to_host, srv_choice.port or connect_port; |
| 115 log("debug", "Best record found, will connect to %s:%d", connect_host, connect_port); | 115 log("debug", "Best record found, will connect to %s:%d", connect_host, connect_port); |
| 116 end | 116 end |
| 117 else | 117 else |
| 118 log("debug", to_host.." has no SRV records, falling back to A/AAAA"); | 118 log("debug", "%s has no SRV records, falling back to A/AAAA", to_host); |
| 119 end | 119 end |
| 120 -- Try with SRV, or just the plain hostname if no SRV | 120 -- Try with SRV, or just the plain hostname if no SRV |
| 121 local ok, err = s2sout.try_connect(host_session, connect_host, connect_port); | 121 local ok, err = s2sout.try_connect(host_session, connect_host, connect_port); |
| 122 if not ok then | 122 if not ok then |
| 123 if not s2sout.attempt_connection(host_session, err) then | 123 if not s2sout.attempt_connection(host_session, err) then |
