Comparison

core/s2smanager.lua @ 2783:57611584e27d

s2smanager: Give reasons to destroy_session in more cases, including when DNS lookup fails
author Matthew Wild <mwild1@gmail.com>
date Thu, 17 Dec 2009 21:50:02 +0000
parent 2781:4b5881b6bbfc
child 2787:1067a454a068
comparison
equal deleted inserted replaced
2782:71e6c13f6e08 2783:57611584e27d
225 -- Try with SRV, or just the plain hostname if no SRV 225 -- Try with SRV, or just the plain hostname if no SRV
226 local ok, err = try_connect(host_session, connect_host, connect_port); 226 local ok, err = try_connect(host_session, connect_host, connect_port);
227 if not ok then 227 if not ok then
228 if not attempt_connection(host_session, err) then 228 if not attempt_connection(host_session, err) then
229 -- No more attempts will be made 229 -- No more attempts will be made
230 destroy_session(host_session); 230 destroy_session(host_session, err);
231 end 231 end
232 end 232 end
233 end, "_xmpp-server._tcp."..connect_host..".", "SRV"); 233 end, "_xmpp-server._tcp."..connect_host..".", "SRV");
234 234
235 -- Set handler for DNS timeout 235 -- Set handler for DNS timeout
285 return make_connect(host_session, reply[#reply].a, connect_port); 285 return make_connect(host_session, reply[#reply].a, connect_port);
286 else 286 else
287 log("debug", "DNS lookup failed to get a response for %s", connect_host); 287 log("debug", "DNS lookup failed to get a response for %s", connect_host);
288 if not attempt_connection(host_session, "name resolution failed") then -- Retry if we can 288 if not attempt_connection(host_session, "name resolution failed") then -- Retry if we can
289 log("debug", "No other records to try for %s - destroying", host_session.to_host); 289 log("debug", "No other records to try for %s - destroying", host_session.to_host);
290 destroy_session(host_session); -- End of the line, we can't 290 destroy_session(host_session, "DNS resolution failed"); -- End of the line, we can't
291 end 291 end
292 end 292 end
293 end, connect_host, "A", "IN"); 293 end, connect_host, "A", "IN");
294 294
295 -- Set handler for DNS timeout 295 -- Set handler for DNS timeout