Mercurial > prosody-hg
comparison core/s2smanager.lua @ 351:b6c552bc5716
Comments and logging fixes
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 19 Nov 2008 22:50:37 +0000 |
| parents | 08f89c25e76e |
| children | e7d776b5ebb9 |
comparison
equal
deleted
inserted
replaced
| 350:08f89c25e76e | 351:b6c552bc5716 |
|---|---|
| 103 end | 103 end |
| 104 t_sort(srv_hosts, compare_srv_priorities); | 104 t_sort(srv_hosts, compare_srv_priorities); |
| 105 | 105 |
| 106 local srv_choice = srv_hosts[1]; | 106 local srv_choice = srv_hosts[1]; |
| 107 if srv_choice then | 107 if srv_choice then |
| 108 log("debug", "Best record found"); | |
| 109 connect_host, connect_port = srv_choice.target or to_host, srv_choice.port or connect_port; | 108 connect_host, connect_port = srv_choice.target or to_host, srv_choice.port or connect_port; |
| 110 log("debug", "Best record found, will connect to %s:%d", connect_host, connect_port); | 109 log("debug", "Best record found, will connect to %s:%d", connect_host, connect_port); |
| 111 end | 110 end |
| 112 end | 111 end |
| 113 | 112 |
| 143 local send = session.sends2s; | 142 local send = session.sends2s; |
| 144 | 143 |
| 145 session.version = tonumber(attr.version) or 0; | 144 session.version = tonumber(attr.version) or 0; |
| 146 if session.version >= 1.0 and not (attr.to and attr.from) then | 145 if session.version >= 1.0 and not (attr.to and attr.from) then |
| 147 print("to: "..tostring(attr.to).." from: "..tostring(attr.from)); | 146 print("to: "..tostring(attr.to).." from: "..tostring(attr.from)); |
| 148 --error(session.to_host.." failed to specify 'to' or 'from' hostname as per RFC"); | |
| 149 log("warn", (session.to_host or "(unknown)").." failed to specify 'to' or 'from' hostname as per RFC"); | 147 log("warn", (session.to_host or "(unknown)").." failed to specify 'to' or 'from' hostname as per RFC"); |
| 150 end | 148 end |
| 151 | 149 |
| 152 if session.direction == "incoming" then | 150 if session.direction == "incoming" then |
| 153 -- Send a reply stream header | 151 -- Send a reply stream header |
| 168 end | 166 end |
| 169 if session.version >= 1.0 then | 167 if session.version >= 1.0 then |
| 170 send(st.stanza("stream:features") | 168 send(st.stanza("stream:features") |
| 171 :tag("dialback", { xmlns='urn:xmpp:features:dialback' }):tag("optional"):up():up()); | 169 :tag("dialback", { xmlns='urn:xmpp:features:dialback' }):tag("optional"):up():up()); |
| 172 end | 170 end |
| 173 --[[ | |
| 174 local features = {}; | |
| 175 modulemanager.fire_event("stream-features-s2s", session, features); | |
| 176 | |
| 177 send("<stream:features>"); | |
| 178 | |
| 179 for _, feature in ipairs(features) do | |
| 180 send(tostring(feature)); | |
| 181 end | |
| 182 | |
| 183 send("</stream:features>"); | |
| 184 ]] | |
| 185 elseif session.direction == "outgoing" then | 171 elseif session.direction == "outgoing" then |
| 186 -- If we are just using the connection for verifying dialback keys, we won't try and auth it | 172 -- If we are just using the connection for verifying dialback keys, we won't try and auth it |
| 187 if not attr.id then error("stream response did not give us a streamid!!!"); end | 173 if not attr.id then error("stream response did not give us a streamid!!!"); end |
| 188 session.streamid = attr.id; | 174 session.streamid = attr.id; |
| 189 | 175 |
