Comparison

core/s2smanager.lua @ 4016:0e927d4644c3

s2smanager: send_to_host(): Return false on failure, and true otherwise
author Matthew Wild <mwild1@gmail.com>
date Wed, 22 Dec 2010 20:38:40 +0000
parent 3650:2b80450bd7ae
child 4017:2cb5bb26b831
comparison
equal deleted inserted replaced
4015:a35fa3368626 4016:0e927d4644c3
103 host.log("debug", "stanza [%s] queued ", data.name); 103 host.log("debug", "stanza [%s] queued ", data.name);
104 elseif host.type == "local" or host.type == "component" then 104 elseif host.type == "local" or host.type == "component" then
105 log("error", "Trying to send a stanza to ourselves??") 105 log("error", "Trying to send a stanza to ourselves??")
106 log("error", "Traceback: %s", get_traceback()); 106 log("error", "Traceback: %s", get_traceback());
107 log("error", "Stanza: %s", tostring(data)); 107 log("error", "Stanza: %s", tostring(data));
108 return false;
108 else 109 else
109 (host.log or log)("debug", "going to send stanza to "..to_host.." from "..from_host); 110 (host.log or log)("debug", "going to send stanza to "..to_host.." from "..from_host);
110 -- FIXME 111 -- FIXME
111 if host.from_host ~= from_host then 112 if host.from_host ~= from_host then
112 log("error", "WARNING! This might, possibly, be a bug, but it might not..."); 113 log("error", "WARNING! This might, possibly, be a bug, but it might not...");
123 host_session.sendq = { {tostring(data), st.reply(data)} }; 124 host_session.sendq = { {tostring(data), st.reply(data)} };
124 log("debug", "stanza [%s] queued until connection complete", tostring(data.name)); 125 log("debug", "stanza [%s] queued until connection complete", tostring(data.name));
125 if (not host_session.connecting) and (not host_session.conn) then 126 if (not host_session.connecting) and (not host_session.conn) then
126 log("warn", "Connection to %s failed already, destroying session...", to_host); 127 log("warn", "Connection to %s failed already, destroying session...", to_host);
127 destroy_session(host_session); 128 destroy_session(host_session);
128 end 129 return false;
129 end 130 end
131 end
132 return true;
130 end 133 end
131 134
132 local open_sessions = 0; 135 local open_sessions = 0;
133 136
134 function new_incoming(conn) 137 function new_incoming(conn)