Comparison

core/s2smanager.lua @ 4026:21edd42768b5

s2smanager: send_to_host(): Handle already-destroyed session and bounce stanza accordingly
author Matthew Wild <mwild1@gmail.com>
date Fri, 24 Dec 2010 04:56:37 +0000
parent 4025:cc2e75e49cfb
child 4027:81d0ed5787f6
comparison
equal deleted inserted replaced
4025:cc2e75e49cfb 4026:21edd42768b5
123 -- Store in buffer 123 -- Store in buffer
124 host_session.sendq = { {tostring(data), st.reply(data)} }; 124 host_session.sendq = { {tostring(data), st.reply(data)} };
125 log("debug", "stanza [%s] queued until connection complete", tostring(data.name)); 125 log("debug", "stanza [%s] queued until connection complete", tostring(data.name));
126 if (not host_session.connecting) and (not host_session.conn) then 126 if (not host_session.connecting) and (not host_session.conn) then
127 log("warn", "Connection to %s failed already, destroying session...", to_host); 127 log("warn", "Connection to %s failed already, destroying session...", to_host);
128 destroy_session(host_session); 128 if not destroy_session(host_session, "Connection failed") then
129 -- Already destroyed, we need to bounce our stanza
130 bounce_sendq(host_session, host_session.destruction_reason);
131 end
129 return false; 132 return false;
130 end 133 end
131 end 134 end
132 return true; 135 return true;
133 end 136 end