Comparison

core/s2smanager.lua @ 2377:78c5cb163ea9

s2smanager: Mark stream as opened sooner, this prevents a duplicated stream header on host-unknown errors (thanks darkrain and his mail server)
author Matthew Wild <mwild1@gmail.com>
date Thu, 17 Dec 2009 21:17:47 +0000
parent 2376:c5faafa89f50
child 2378:bc1ae371ad54
child 2379:66ba153d3f09
comparison
equal deleted inserted replaced
2376:c5faafa89f50 2377:78c5cb163ea9
364 session.streamid = uuid_gen(); 364 session.streamid = uuid_gen();
365 (session.log or log)("debug", "incoming s2s received <stream:stream>"); 365 (session.log or log)("debug", "incoming s2s received <stream:stream>");
366 send("<?xml version='1.0'?>"); 366 send("<?xml version='1.0'?>");
367 send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', 367 send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback',
368 ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host, version=(session.version > 0 and "1.0" or nil) }):top_tag()); 368 ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host, version=(session.version > 0 and "1.0" or nil) }):top_tag());
369 session.notopen = nil;
369 if session.to_host and not hosts[session.to_host] then 370 if session.to_host and not hosts[session.to_host] then
370 -- Attempting to connect to a host we don't serve 371 -- Attempting to connect to a host we don't serve
371 session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host }); 372 session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host });
372 return; 373 return;
373 end 374 end
410 else 411 else
411 mark_connected(session); 412 mark_connected(session);
412 end 413 end
413 end 414 end
414 end 415 end
415
416 session.notopen = nil;
417 end 416 end
418 417
419 function streamclosed(session) 418 function streamclosed(session)
420 (session.log or log)("debug", "</stream:stream>"); 419 (session.log or log)("debug", "</stream:stream>");
421 if session.sends2s then 420 if session.sends2s then