Comparison

plugins/mod_s2s/mod_s2s.lua @ 6684:53635a91c95c

mod_s2s: Mark stream as opened directly after opening stream, prevents session.close opening it again
author Kim Alvefur <zash@zash.se>
date Wed, 13 May 2015 21:56:22 +0200
parent 6683:873ad1023eb0
child 6685:3f05b255937f
child 7100:301d58705667
comparison
equal deleted inserted replaced
6683:873ad1023eb0 6684:53635a91c95c
347 return; 347 return;
348 end 348 end
349 end 349 end
350 350
351 session:open_stream(session.to_host, session.from_host) 351 session:open_stream(session.to_host, session.from_host)
352 session.notopen = nil;
352 if session.version >= 1.0 then 353 if session.version >= 1.0 then
353 local features = st.stanza("stream:features"); 354 local features = st.stanza("stream:features");
354 355
355 if to then 356 if to then
356 hosts[to].events.fire_event("s2s-stream-features", { origin = session, features = features }); 357 hosts[to].events.fire_event("s2s-stream-features", { origin = session, features = features });
359 end 360 end
360 361
361 log("debug", "Sending stream features: %s", tostring(features)); 362 log("debug", "Sending stream features: %s", tostring(features));
362 session.sends2s(features); 363 session.sends2s(features);
363 end 364 end
364 session.notopen = nil;
365 elseif session.direction == "outgoing" then 365 elseif session.direction == "outgoing" then
366 session.notopen = nil; 366 session.notopen = nil;
367 if not attr.id then 367 if not attr.id then
368 log("error", "Stream response did not give us a stream id!"); 368 log("error", "Stream response did not give us a stream id!");
369 session:close({ condition = "undefined-condition", text = "Missing stream ID" }); 369 session:close({ condition = "undefined-condition", text = "Missing stream ID" });