Comparison

core/s2smanager.lua @ 3947:21391aa2d9bc

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 3733:26571a99f6e6
child 3948:d0b8fa486458
comparison
equal deleted inserted replaced
3946:14239141764f 3947:21391aa2d9bc
104 host.log("debug", "stanza [%s] queued ", data.name); 104 host.log("debug", "stanza [%s] queued ", data.name);
105 elseif host.type == "local" or host.type == "component" then 105 elseif host.type == "local" or host.type == "component" then
106 log("error", "Trying to send a stanza to ourselves??") 106 log("error", "Trying to send a stanza to ourselves??")
107 log("error", "Traceback: %s", get_traceback()); 107 log("error", "Traceback: %s", get_traceback());
108 log("error", "Stanza: %s", tostring(data)); 108 log("error", "Stanza: %s", tostring(data));
109 return false;
109 else 110 else
110 (host.log or log)("debug", "going to send stanza to "..to_host.." from "..from_host); 111 (host.log or log)("debug", "going to send stanza to "..to_host.." from "..from_host);
111 -- FIXME 112 -- FIXME
112 if host.from_host ~= from_host then 113 if host.from_host ~= from_host then
113 log("error", "WARNING! This might, possibly, be a bug, but it might not..."); 114 log("error", "WARNING! This might, possibly, be a bug, but it might not...");
124 host_session.sendq = { {tostring(data), st.reply(data)} }; 125 host_session.sendq = { {tostring(data), st.reply(data)} };
125 log("debug", "stanza [%s] queued until connection complete", tostring(data.name)); 126 log("debug", "stanza [%s] queued until connection complete", tostring(data.name));
126 if (not host_session.connecting) and (not host_session.conn) then 127 if (not host_session.connecting) and (not host_session.conn) then
127 log("warn", "Connection to %s failed already, destroying session...", to_host); 128 log("warn", "Connection to %s failed already, destroying session...", to_host);
128 destroy_session(host_session); 129 destroy_session(host_session);
129 end 130 return false;
130 end 131 end
132 end
133 return true;
131 end 134 end
132 135
133 local open_sessions = 0; 136 local open_sessions = 0;
134 137
135 function new_incoming(conn) 138 function new_incoming(conn)