Comparison

plugins/mod_s2s/mod_s2s.lua @ 4906:89df1f03546a

mod_s2s, s2sout.lib: Send stream header in onconnect()
author Matthew Wild <mwild1@gmail.com>
date Thu, 24 May 2012 03:08:42 +0100
parent 4873:19e69cea6146
child 4960:8950510ddb2e
comparison
equal deleted inserted replaced
4905:274ef78aa173 4906:89df1f03546a
425 session:close("connection-timeout"); 425 session:close("connection-timeout");
426 end); 426 end);
427 end 427 end
428 428
429 function listener.onconnect(conn) 429 function listener.onconnect(conn)
430 if not sessions[conn] then -- May be an existing outgoing session 430 local session = sessions[conn];
431 local session = s2s_new_incoming(conn); 431 if not session then -- New incoming connection
432 session = s2s_new_incoming(conn);
432 sessions[conn] = session; 433 sessions[conn] = session;
433 session.log("debug", "Incoming s2s connection"); 434 session.log("debug", "Incoming s2s connection");
434 435
435 local filter = initialize_filters(session); 436 local filter = initialize_filters(session);
436 local w = conn.write; 437 local w = conn.write;
446 end 447 end
447 end 448 end
448 end 449 end
449 450
450 initialize_session(session); 451 initialize_session(session);
452 else -- Outgoing session connected
453 session:open_stream(session.from_host, session.to_host);
451 end 454 end
452 end 455 end
453 456
454 function listener.onincoming(conn, data) 457 function listener.onincoming(conn, data)
455 local session = sessions[conn]; 458 local session = sessions[conn];